Created
November 8, 2023 15:48
-
-
Save martinctc/9fd81725ca29468ecc0ab1c91cb698d6 to your computer and use it in GitHub Desktop.
[Get PyPI statistics] #python
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 requests | |
import pandas as pd | |
package_name = "vivainsights" | |
api_endpoint = f"https://pypistats.org/api/packages/{package_name}/overall" | |
response = requests.get(api_endpoint) | |
if response.status_code == 200: | |
data = response.json() | |
df = pd.DataFrame(data["data"]) | |
print(df) | |
else: | |
print(f"Error: {response.status_code} - {response.reason}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment