Registry / http-networking / pypi-json

pypi-json

JSON →
library0.5.0.post1pypypi✓ verified 87d ago

pypi-json is a Python client library for accessing the PyPI JSON API. It allows programmatic retrieval of package metadata, including versions, summaries, dependencies, and more. The current version is 0.5.0.post1, and it has an infrequent but active release cadence, with the latest update in February 2026.

pip install pypi-json
INSTALL
IMPORT
SIG · PYPI-JSON
P
pypi-json
http-networkingpythonv0.5.0.post1
Install
2.6s avg
Import
691ms
Disk
23MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.5.0.post1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.724s · 24.3MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 2.6s · import 0.657s · 25MB
23MB installed
● package 23MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

PyPIJSON
from pypi_json import PyPIJSON

This quickstart demonstrates how to instantiate the PyPIJSON client and retrieve metadata for a specific package, such as 'requests'. It shows how to access basic package attributes and specific release information, including error handling for network or package not found issues.

from pypi_json import PyPIJSON pypi = PyPIJSON() try: # Example: Get metadata for the 'requests' package package = pypi.get_package("requests") print(f"Package Name: {package.name}") print(f"Latest Version: {package.version}") print(f"Summary: {package.summary}") # Accessing specific release information if package.releases: latest_release_info = package.releases[package.version] print(f"Upload Time of latest version: {latest_release_info.upload_time_iso_8601}") except Exception as e: print(f"An error occurred: {e}")
Debug
Known issues
gotchaThe `get_package` method raises an `httpx.HTTPStatusError` (specifically a 404 Not Found error) if the requested package does not exist on PyPI, rather than returning `None`. Users should implement error handling for this scenario.
fix
Wrap calls to `pypi.get_package()` in a `try...except httpx.HTTPStatusError` block to gracefully handle non-existent packages.
affects: All versions
gotchaThe attributes of the returned `Package` object (and its nested objects like `Release`) directly mirror the structure of the raw PyPI JSON API response. If the PyPI API changes its schema, or if you attempt to access an attribute not present for a specific package/version, an `AttributeError` will be raised.
fix
Refer to the official PyPI JSON API documentation or inspect the object's available attributes (e.g., `dir(package)`) to ensure correct field access. Be prepared for schema changes in future PyPI API versions.
affects: All versions
Errors
Common errors & fixes
httpx.HTTPStatusError: Client error '404 Not Found' for url 'https://pypi.org/pypi/nonexistent-package/json'
The package name provided to `get_package` does not exist on PyPI, or it is misspelled.
fix
Verify the package name for correctness. Implement `try...except httpx.HTTPStatusError` to handle non-existent packages gracefully.
AttributeError: 'Package' object has no attribute 'some_nonexistent_field'
You are attempting to access an attribute on the `Package` object that does not exist in the PyPI JSON API response or is misspelled.
fix
Check the available attributes of the `Package` object (e.g., by printing `dir(package)`) or consult the PyPI JSON API documentation to find the correct attribute name.
httpx.ConnectError: [Errno 11001] getaddrinfo failed
The client could not establish a network connection to PyPI. This can be due to a lack of internet connectivity, DNS resolution issues, a firewall blocking access, or PyPI being temporarily unavailable.
fix
Check your internet connection and DNS settings. Ensure no firewall is blocking access to `pypi.org`. If the issue persists, PyPI might be experiencing downtime, so try again later.
Upgrade
Version history
0.5.0.post1latest on PyPI · released Feb 19, 2026
Audit
Dependencies
httpx>=0.20.0requiredRequired for making HTTP requests to the PyPI API.
domdf-python-toolsrequiredUtility functions used internally by the library.
dist-metarequiredMetadata parsing and handling.
Agent activity
12 hits · last 30 days
node
6
Resources
pypi-json — pip install pypi-json · libregistry