Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

api_stats-0.2.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

api_stats-0.2-py2.py3-none-any.whl (5.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file api_stats-0.2.tar.gz.

File metadata

  • Download URL: api_stats-0.2.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for api_stats-0.2.tar.gz
Algorithm Hash digest
SHA256 49f8b352ee6c09b53b576111cfb76e3a8402cbc871584018ddb09158fc9599c9
MD5 571b108c5e9b24ec29377028f5e03e45
BLAKE2b-256 cc546f031ea4ef4c5116bf80f6691e1276bf7602776042c29c07b59e155333f5

See more details on using hashes here.

File details

Details for the file api_stats-0.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for api_stats-0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c1d54926d418ebaad96e4ababc03b5a99914b36f38417c6dab15aec98b538daa
MD5 494e1650a542031efd2c6cc4f632c515
BLAKE2b-256 39d25f1738085021918a4868c5094737e088a08792193ccab8c519ff76895d21

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page