GoatPie
"GoatCounter" analytics for the CLI, written in Python - get it?
Installation
It's available from PyPi using pip:
pip install goatpie
Getting started
Using this library is straightforward.
Commandline
Pretty much self-explanatory - otherwise, --help is your friend:
$ goatpie --help
Usage: goatpie [OPTIONS] URL
Provides 'Goatcounter' statistics for URL
Options:
-u, --update Forces update of local database
-l, --limit INTEGER Shows visits & pageviews for the last XY days. Default: 14
-b, --bar-colors TEXT Defines two bar colors. Default: 'blue,magenta'
-t, --text-colors TEXT Defines three text colors. Default: 'blue,white,cyan'
--version Show the version and exit.
--help Show this message and exit.
Package
The underlying module may also be used directly:
from goatpie import GoatPie
# Initialize it
obj = GoatPie(url, token)
# Optionally with `data_dir` (SQLite database, config, etc)
obj = GoatPie(url, token, data_dir)
# Update database
# (1) Last update not before one hour (in seconds)
obj.update(3600)
# (2) Force database update
obj.update(0)
# Get pageviews as `pandas.DataFrame` (last seven days)
print(obj.get_pageviews(7))
# Day Pageviews
# 0 2022-08-28 1
# 1 2022-08-27 13
# 2 2022-08-26 20
# 3 2022-08-25 35
# 4 2022-08-24 84
# 5 2022-08-23 64
# 6 2022-08-22 23
Configuration
Besides CLI options (see goatpie --help) you may also configure various options inside ~/.config/goatpie/config.ini like so:
[DEFAULT]
interval = 3600
step = 100
bar_colors = blue,magenta
text_colors = blue,white,cyan
[stats.example.com]
interval = 0 # force updates
step = 1000 # more visitors
bar_colors = yellow,red # hotter colors
text_colors = black,blue,black # better suited for light screens
When first connecting to a 'GoatCounter' domain (such as stats.example.com), you are asked to store your token, in which case your configuration might look like this:
[DEFAULT]
interval = 3600
[stats.example.com]
interval = 0 # force updates
token = my-s3cr3t-t0k3n
[stats.another-example.com]
interval = 1800 # half hour
token = my-0th3r-s3cr3t-t0k3n
Note: Section headers are named after the GoatCounter API endpoints you are using, NOT the pages you are tracking!
Roadmap
- Add tests
- Add more tests
- Add logger
- Config file
- Explain configuration
Metadata
Release files for goatpie 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| goatpie-0.4.0.tar.gz | 119.2 kB | Without provenance | Details for goatpie-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| goatpie-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for goatpie-0.4.0-py3-none-any.whl |
Total release size: 144.1 kB
Release files / goatpie-0.4.0.tar.gz
| Download URL | goatpie-0.4.0.tar.gz |
|---|---|
| Size | 119.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
14080bb9e317158da1de227364bd3414ae14bf42f6f4650737070d804eb1d8d5
|
|
BLAKE2b-256 checksum How to use checksums |
f8c9b923604d77edcac0e288aee0b8d92986993eaefc31437f1d9f127f84aef7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.28.1
|
Release files / goatpie-0.4.0-py3-none-any.whl
| Download URL | goatpie-0.4.0-py3-none-any.whl |
|---|---|
| Size | 25.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9a169a7a5144681fec209d6e36b0675e1d131cd0cdac86d75b151ead375538b6
|
|
BLAKE2b-256 checksum How to use checksums |
414aeb207f967b5385626ebda8533acdafdc3f355944e2896f7cbcacba25c69a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.28.1
|
Security for goatpie 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.