update readme; better api

This commit is contained in:
crflynn
2018-04-28 01:27:26 -04:00
parent a02c623d88
commit d257b596e4
3 changed files with 27 additions and 11 deletions

View File

@@ -5,3 +5,19 @@ A simple analytics dashboard for aggregate data on PyPI downloads. PyPI Stats
is built using Flask with plotly.js and deployed to AWS elasticbeanstalk.
`PyPI Stats <https://pypistats.org/>`_
GitHub OAuth
------------
PyPI Stats has an integration with GitHub so you can track install data on the
packages you maintain.
`User page <https://pypistats.org/user>`_
JSON API
--------
PyPI Stats provides a simple JSON API to retrieve aggregate download stats
and time histories of pypi packages.
`JSON API <https://pypistats.org/api>`_

View File

@@ -17,7 +17,7 @@
</ul>
</p>
<h2>Endpoints</h2>
<h3>/api/&lt;package&gt;/recent</h3>
<h3>/api/package/&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/&lt;package&gt;/overall</h3>
<h3>/api/package/&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/&lt;package&gt;/python_major</h3>
<h3>/api/package/&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/&lt;package&gt;/python_minor</h3>
<h3>/api/package/&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/&lt;package&gt;/system</h3>
<h3>/api/package/&lt;package&gt;/system</h3>
<p>Retrieve the aggregate daily download time series by operating system.
</p>
<p>Query arguments:
@@ -232,4 +232,4 @@
}</code></pre>
</p>
{% endblock %}
{% endblock %}

View File

@@ -23,7 +23,7 @@ def api():
return render_template("api.html", user=g.user)
@blueprint.route("/<package>/recent")
@blueprint.route("/package/<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>/overall")
@blueprint.route("/package/<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>/python_major")
@blueprint.route("/package/<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>/python_minor")
@blueprint.route("/package/<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>/system")
@blueprint.route("/package/<package>/system")
def api_downloads_system(package):
"""Get the system download time series of a package."""
return generic_downloads(