Skip to content
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

Merged
merged 1 commit into from
Sep 26, 2023

Conversation

chris48s
Copy link
Member

@chris48s chris48s added the service-badge New or updated service badge label Sep 11, 2023
const description = `
Python package total downloads from [Pepy](https://www.pepy.tech/).

Download stats from pepy count package downloads from PyPI and known mirrors.`
Copy link
Member Author

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',
Copy link
Member Author

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
Copy link
Member Author

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}`,
Copy link
Member Author

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.

@github-actions
Copy link
Contributor

Messages
📖 ✨ Thanks for your contribution to Shields, @chris48s!

Generated by 🚫 dangerJS against 10d271d

@calebcartwright calebcartwright added this pull request to the merge queue Sep 26, 2023
Merged via the queue into badges:master with commit 70d22c3 Sep 26, 2023
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service-badge New or updated service badge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Badge request: Total PyPI downloads
2 participants