Last active
January 20, 2022 11:43
-
-
Save slapslash/d95483b5f3e6d20aaae528828025f990 to your computer and use it in GitHub Desktop.
Get a random selection from the top 5000 PyPI packages and show a short summary of them.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import requests | |
# will be updated monthly. | |
top_url = "https://hugovk.github.io/top-pypi-packages/top-pypi-packages-30-days.min.json" | |
data = requests.get(top_url).json() | |
packs = [d["project"] for d in data["rows"]] | |
for _ in range(3): | |
random_pack = random.choice(packs) | |
pypi_url = "https://pypi.org/pypi/{}/json".format(random_pack) | |
p = requests.get(pypi_url).json() | |
print(random_pack + ":", p["info"]["summary"]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment