PyPI Stats provides a simple JSON API for retrieving aggregate download stats and time series for packages. The
following are the valid endpoints using host:
https://pypistats.org/
If you plan on using the API to download historical data for every python package in the database (e.g. for some personal data exploration), DON'T. This website runs on limited resources and you will degrade the site performance by doing this. It will also take a very long time.
You are much better off extracting the data directly from the Google BigQuery pypi downloads tables. You can query up to 1TB of data FREE every month before having to pay. The volume of data queried for this website falls well under that limit (each month of data is less than 100 GB queried) and you will have your data in a relatively short amount of time. Here is a quick guide.
If you want to regularly fetch download counts for a particular package or set of packages, cache your results. The data provided here is updated once daily, so you should not need to fetch results from the same API endpoint more than once per day.
IP-based rate limiting is imposed application-wide.
The pypistats package is a python client and CLI tool for easily accessing, aggregating, and formatting results from the API. To install, use pip:
pip install -U pypistats
Refer to the documentation for usage.
Retrieve the aggregate download quantities for the last day/week/month.
Query arguments:
day
or
week
or
month
. If omitted returns all values.
{
"data": {
"last_day": 1,
"last_month": 2,
"last_week": 3
},
"package": "package_name",
"type": "recent_downloads"
}
Retrieve the aggregate daily download time series with or without mirror downloads.
Query arguments:
true
or
false
. If omitted returns both series data.
{
"data": [
{
"category": "with_mirrors",
"date": "2018-02-08",
"downloads": 1
},
{
"category": "without_mirrors",
"date": "2018-02-08",
"downloads": 1
}
],
"package": "package_name",
"type": "overall_downloads"
}
Retrieve the aggregate daily download time series by Python major version number.
Query arguments:
2
or
3
. If omitted returns all series data (including
null
).
{
"data": [
{
"category": "2",
"date": "2018-02-08",
"downloads": 1
},
{
"category": "3",
"date": "2018-02-08",
"downloads": 1
},
{
"category": "null",
"date": "2018-02-08",
"downloads": 1
}
],
"package": "package_name",
"type": "python_major_downloads"
}
Retrieve the aggregate daily download time series by Python minor version number.
Query arguments:
2.7
or
3.6
. If omitted returns all series data (including
null
).
{
"data": [
{
"category": "2.6",
"date": "2018-02-08",
"downloads": 1
},
{
"category": "2.7",
"date": "2018-02-08",
"downloads": 1
},
{
"category": "3.2",
"date": "2018-02-08",
"downloads": 1
},
{
"category": "3.3",
"date": "2018-02-08",
"downloads": 1
},
{
"category": "3.4",
"date": "2018-02-08",
"downloads": 1
},
{
"category": "3.5",
"date": "2018-02-08",
"downloads": 1
},
{
"category": "3.6",
"date": "2018-02-08",
"downloads": 1
},
{
"category": "3.7",
"date": "2018-02-08",
"downloads": 1
},
{
"category": "null",
"date": "2018-02-08",
"downloads": 1
}
],
"package": "package_name",
"type": "python_minor_downloads"
}
Retrieve the aggregate daily download time series by operating system.
Query arguments:
windows
,
linux
,
darwin
or
other
. If omitted returns all series data (including
null
).
{
"data": [
{
"category": "darwin",
"date": "2018-02-08",
"downloads": 1
},
{
"category": "linux",
"date": "2018-02-08",
"downloads": 1
},
{
"category": "null",
"date": "2018-02-08",
"downloads": 1
},
{
"category": "other",
"date": "2018-02-08",
"downloads": 1
},
{
"category": "windows",
"date": "2018-02-08",
"downloads": 1
}
],
"package": "package_name",
"type": "system_downloads"
}