From 75dc160db6af60e0b54f30130dbde943d462e8ae Mon Sep 17 00:00:00 2001 From: crflynn Date: Wed, 12 Dec 2018 22:24:27 -0500 Subject: [PATCH] allow underscores in api endpoints --- pypistats/views/api.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pypistats/views/api.py b/pypistats/views/api.py index eb5b234..8b1e809 100644 --- a/pypistats/views/api.py +++ b/pypistats/views/api.py @@ -26,7 +26,7 @@ def api(): @blueprint.route("/packages//recent") def api_downloads_recent(package): """Get the recent downloads of a package.""" - package = package.replace(".", "-") + package = package.replace(".", "-").replace("_", "-") category = request.args.get("period") if category is None: downloads = RecentDownloadCount.query.\ @@ -55,7 +55,7 @@ def api_downloads_recent(package): def api_downloads_overall(package): """Get the overall download time series of a package.""" abort(503) - package = package.replace(".", "-") + package = package.replace(".", "-").replace("_", "-") mirrors = request.args.get("mirrors") if mirrors == "true": downloads = OverallDownloadCount.query.\ @@ -108,7 +108,7 @@ def api_downloads_system(package): def generic_downloads(model, package, arg, name): """Generate a generic response.""" abort(503) - package = package.replace(".", "-") + package = package.replace(".", "-").replace("_", "-") category = request.args.get(arg) if category is not None: downloads = model.query.\