mirror of
https://github.com/LukeHagar/pypistats.dev.git
synced 2025-12-09 12:47:48 +00:00
allow underscores in api endpoints
This commit is contained in:
@@ -26,7 +26,7 @@ def api():
|
|||||||
@blueprint.route("/packages/<package>/recent")
|
@blueprint.route("/packages/<package>/recent")
|
||||||
def api_downloads_recent(package):
|
def api_downloads_recent(package):
|
||||||
"""Get the recent downloads of a package."""
|
"""Get the recent downloads of a package."""
|
||||||
package = package.replace(".", "-")
|
package = package.replace(".", "-").replace("_", "-")
|
||||||
category = request.args.get("period")
|
category = request.args.get("period")
|
||||||
if category is None:
|
if category is None:
|
||||||
downloads = RecentDownloadCount.query.\
|
downloads = RecentDownloadCount.query.\
|
||||||
@@ -55,7 +55,7 @@ def api_downloads_recent(package):
|
|||||||
def api_downloads_overall(package):
|
def api_downloads_overall(package):
|
||||||
"""Get the overall download time series of a package."""
|
"""Get the overall download time series of a package."""
|
||||||
abort(503)
|
abort(503)
|
||||||
package = package.replace(".", "-")
|
package = package.replace(".", "-").replace("_", "-")
|
||||||
mirrors = request.args.get("mirrors")
|
mirrors = request.args.get("mirrors")
|
||||||
if mirrors == "true":
|
if mirrors == "true":
|
||||||
downloads = OverallDownloadCount.query.\
|
downloads = OverallDownloadCount.query.\
|
||||||
@@ -108,7 +108,7 @@ def api_downloads_system(package):
|
|||||||
def generic_downloads(model, package, arg, name):
|
def generic_downloads(model, package, arg, name):
|
||||||
"""Generate a generic response."""
|
"""Generate a generic response."""
|
||||||
abort(503)
|
abort(503)
|
||||||
package = package.replace(".", "-")
|
package = package.replace(".", "-").replace("_", "-")
|
||||||
category = request.args.get(arg)
|
category = request.args.get(arg)
|
||||||
if category is not None:
|
if category is not None:
|
||||||
downloads = model.query.\
|
downloads = model.query.\
|
||||||
|
|||||||
Reference in New Issue
Block a user