fix routes and api refs

This commit is contained in:
crflynn
2018-05-06 13:00:58 -04:00
parent c62925c21c
commit 78b0fe3472
4 changed files with 35 additions and 35 deletions

View File

@@ -17,7 +17,7 @@
</ul>
</p>
<h2>Endpoints</h2>
<h3>/api/package/&lt;package&gt;/recent</h3>
<h3>/api/packages/&lt;package&gt;/recent</h3>
<p>Retrieve the aggregate download quantities for the last day/week/month.
</p>
<p>Query arguments:
@@ -43,7 +43,7 @@
"type": "recent_downloads"
}</code></pre>
</p>
<h3>/api/package/&lt;package&gt;/overall</h3>
<h3>/api/packages/&lt;package&gt;/overall</h3>
<p>Retrieve the aggregate daily download time series with or without mirror downloads.
</p>
<p>Query arguments:
@@ -75,7 +75,7 @@
"type": "overall_downloads"
}</code></pre>
</p>
<h3>/api/package/&lt;package&gt;/python_major</h3>
<h3>/api/packages/&lt;package&gt;/python_major</h3>
<p>Retrieve the aggregate daily download time series by Python major version number.
</p>
<p>Query arguments:
@@ -113,7 +113,7 @@
"type": "python_major_downloads"
}</code></pre>
</p>
<h3>/api/package/&lt;package&gt;/python_minor</h3>
<h3>/api/packages/&lt;package&gt;/python_minor</h3>
<p>Retrieve the aggregate daily download time series by Python minor version number.
</p>
<p>Query arguments:
@@ -181,7 +181,7 @@
"type": "python_minor_downloads"
}</code></pre>
</p>
<h3>/api/package/&lt;package&gt;/system</h3>
<h3>/api/packages/&lt;package&gt;/system</h3>
<p>Retrieve the aggregate daily download time series by operating system.
</p>
<p>Query arguments:

View File

@@ -23,7 +23,7 @@ def api():
return render_template("api.html", user=g.user)
@blueprint.route("/package/<package>/recent")
@blueprint.route("/packages/<package>/recent")
def api_downloads_recent(package):
"""Get the recent downloads of a package."""
category = request.args.get('period')
@@ -50,7 +50,7 @@ def api_downloads_recent(package):
return jsonify(response)
@blueprint.route("/package/<package>/overall")
@blueprint.route("/packages/<package>/overall")
def api_downloads_overall(package):
"""Get the overall download time series of a package."""
mirrors = request.args.get('mirrors')
@@ -81,21 +81,21 @@ def api_downloads_overall(package):
return jsonify(response)
@blueprint.route("/package/<package>/python_major")
@blueprint.route("/packages/<package>/python_major")
def api_downloads_python_major(package):
"""Get the python major download time series of a package."""
return generic_downloads(
PythonMajorDownloadCount, package, "version", "python_major")
@blueprint.route("/package/<package>/python_minor")
@blueprint.route("/packages/<package>/python_minor")
def api_downloads_python_minor(package):
"""Get the python minor download time series of a package."""
return generic_downloads(
PythonMinorDownloadCount, package, "version", "python_minor")
@blueprint.route("/package/<package>/system")
@blueprint.route("/packages/<package>/system")
def api_downloads_system(package):
"""Get the system download time series of a package."""
return generic_downloads(
@@ -126,26 +126,26 @@ def generic_downloads(model, package, arg, name):
return jsonify(response)
@blueprint.route("/top/overall")
def api_top_packages():
"""Get the most downloaded packages by recency."""
return "top overall"
@blueprint.route("/top/python_major")
def api_top_python_major():
"""Get the most downloaded packages by python major version."""
return "top python_major"
@blueprint.route("/top/python_minor")
def api_top_python_minor():
"""Get the most downloaded packages by python minor version."""
return "top python_minor"
@blueprint.route("/top/system")
def api_top_system():
"""Get the most downloaded packages by system."""
return "top python_minor"
# TODO
# @blueprint.route("/top/overall")
# def api_top_packages():
# """Get the most downloaded packages by recency."""
# return "top overall"
#
#
# @blueprint.route("/top/python_major")
# def api_top_python_major():
# """Get the most downloaded packages by python major version."""
# return "top python_major"
#
#
# @blueprint.route("/top/python_minor")
# def api_top_python_minor():
# """Get the most downloaded packages by python minor version."""
# return "top python_minor"
#
#
# @blueprint.route("/top/system")
# def api_top_system():
# """Get the most downloaded packages by system."""
# return "top python_minor"

View File

@@ -80,7 +80,7 @@ def about():
return render_template("about.html", user=g.user)
@blueprint.route("/package/<package>")
@blueprint.route("/packages/<package>")
def package(package):
"""Render the package page."""
# Recent download stats

View File

@@ -96,7 +96,7 @@ def user():
return render_template("user.html", user=g.user)
@blueprint.route("/user/package/<package>")
@blueprint.route("/user/packages/<package>")
def user_package(package):
"""Handle adding and deleting packages to user's list."""
if g.user: