Record historical statistics from an API that only offers current numbers.
Project description
api_stats is a Python tool aimed at recording statistics from an API endpoint. For example, the GitHub API gives out a single number of downloads for each release; by running this tool, you can easily graph rolling averages and historical figures.
Quickstart
api_stats loads a “configuration file” that tells it what to fetch and which fields to record. This file is a Python script that will be loaded by api_stats, with a single global stats that acts as the interface with the program. This interface currently offers two functions: record(key, value), and get_json(url).
Here is an example configuration file, that records the number of downloads of each file from GitHub releases:
releases = stats.get_json( "https://api.github.com/repos/remram44/api_stats/releases") for release in releases: relname = release.get('tag_name') or release['name'] for asset in release['assets']: stats.record('%s/%s' % (relname, asset['name']), asset['download_count'])
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file api_stats-0.1.tar.gz
.
File metadata
- Download URL: api_stats-0.1.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f3ae7b299bd785176bde553ae9708b8aa256e3ae87bf6f327ccdf0ab8c1d98c9 |
|
MD5 | dc3993017a4a850fcbcfe3b3b06ce372 |
|
BLAKE2b-256 | 87b5302c97341d256a6e60243e79240c866c5425a5b929645fee65014432d13e |
File details
Details for the file api_stats-0.1-py2.py3-none-any.whl
.
File metadata
- Download URL: api_stats-0.1-py2.py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f7e9216da4381aa673f5da6bc2884424ff8f875749efb582bb89738b8671cd2 |
|
MD5 | ea18cd613a7f8ca951c436a9e20042ab |
|
BLAKE2b-256 | f7f7aeaa7144e833cb888b85e024b0a47dc36c6f39e6d56e0b1570f7d5b2c8d9 |