Back to articles
PyPI Has a Secret JSON API — Analyze Any Python Package Without Installing It

PyPI Has a Secret JSON API — Analyze Any Python Package Without Installing It

via Dev.to BeginnersAlex Spinov

PyPI — the Python Package Index — has a free JSON API that nobody talks about. You can look up any package's metadata, downloads, dependencies, and version history without installing anything. No API key. No rate limits. Just HTTP requests. The PyPI JSON API Every package on PyPI has a public JSON endpoint: https://pypi.org/pypi/{package_name}/json That is it. No auth, no signup, no tokens. What You Can Extract 1. Package Metadata import urllib.request import json def get_package ( name ): url = f " https://pypi.org/pypi/ { name } /json " resp = urllib . request . urlopen ( url ) return json . loads ( resp . read ()) pkg = get_package ( " requests " ) info = pkg [ " info " ] print ( f " Name: { info [ ' name ' ] } " ) print ( f " Version: { info [ ' version ' ] } " ) print ( f " Summary: { info [ ' summary ' ] } " ) print ( f " Author: { info [ ' author ' ] } " ) print ( f " License: { info [ ' license ' ] } " ) print ( f " Home page: { info [ ' home_page ' ] } " ) print ( f " Requires

Continue reading on Dev.to Beginners

Opens in a new tab

Read Full Article
7 views

Related Articles