diff --git a/pypistats/templates/api.html b/pypistats/templates/api.html index cc6a9b3..32457b9 100644 --- a/pypistats/templates/api.html +++ b/pypistats/templates/api.html @@ -19,6 +19,20 @@
+ 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. +
The pypistats /overall") def api_downloads_overall(package): """Get the overall download time series of a package.""" + # abort(503) package = package.replace(".", "-") mirrors = request.args.get("mirrors") if mirrors == "true": @@ -106,6 +107,7 @@ def api_downloads_system(package): def generic_downloads(model, package, arg, name): """Generate a generic response.""" + # abort(503) package = package.replace(".", "-") category = request.args.get(arg) if category is not None: diff --git a/pypistats/views/error.py b/pypistats/views/error.py index 616df23..536a400 100644 --- a/pypistats/views/error.py +++ b/pypistats/views/error.py @@ -26,3 +26,9 @@ def handle_404(err): def handle_500(err): """Return 500.""" return "500", 500 + + +@blueprint.app_errorhandler(503) +def handle_503(err): + """Return 500.""" + return "503 TEMPORARILY DISABLED", 503