-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add python package total downloads from [pepy] badge #9564
Conversation
const description = ` | ||
Python package total downloads from [Pepy](https://www.pepy.tech/). | ||
|
||
Download stats from pepy count package downloads from PyPI and known mirrors.` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As noted in #4319 (comment) I've decided to add this as "python package total downloads from pepy", not "PyPI total downloads" due to inclusion of downloads from known mirrors in these stats.
|
||
static route = { | ||
base: 'pepy', | ||
pattern: 'dt/:packageName', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've only added total for now, but in principle we could make this :period(dw|dm|dt)
or something in future without introducing a redirect
}, | ||
} | ||
|
||
static _cacheLength = 21600 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pepy only updates once per day so we can put quite a long cache on this
|
||
async fetch({ packageName }) { | ||
return this._requestJson({ | ||
url: `https://api.pepy.tech/api/v2/projects/${packageName}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed in psincraian/pepy#573 we might need to supply an API key here in future but for now, we'll start off using anonymous access.
Closes #4319
Refs psincraian/pepy#573