API to DataFrame
Fetch JSON from any HTTP API and turn it into a pandas DataFrame in two calls — with optional retry strategies.
Install
pip install api-to-dataframe
# or
poetry add api-to-dataframe
Requires Python 3.10+.
Quick start
from api_to_dataframe import ClientBuilder, RetryStrategies
client = ClientBuilder(endpoint="https://api.example.com/items")
data = client.get_api_data()
df = client.api_to_dataframe(data)
api_to_dataframe expects the response to be a list of dicts. An empty result raises ValueError.
Configuration
client = ClientBuilder(
endpoint="https://api.example.com/items",
headers={"Authorization": "Bearer ..."},
retry_strategy=RetryStrategies.EXPONENTIAL_RETRY_STRATEGY,
retries=5,
initial_delay=2,
connection_timeout=10,
)
| Parameter | Default | Description |
|---|---|---|
endpoint |
— (required) | Target URL. |
headers |
None |
Request headers. |
retry_strategy |
NO_RETRY_STRATEGY |
See strategies below. |
retries |
3 |
Max attempts. Hard-capped at 5. |
initial_delay |
1 |
Base delay in seconds between retries. |
connection_timeout |
10 |
Per-request timeout in seconds. |
Retry strategies
NO_RETRY_STRATEGY— fail fast on the first error.LINEAR_RETRY_STRATEGY— waitinitial_delayseconds before each retry.EXPONENTIAL_RETRY_STRATEGY— waitinitial_delay * retry_numberseconds before each retry.
Retries are capped at 5 regardless of the retries value.
Links
Metadata
Release files for api-to-dataframe 2.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| api_to_dataframe-2.2.3.tar.gz | 4.8 kB | Without provenance | Details for api_to_dataframe-2.2.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| api_to_dataframe-2.2.3-py3-none-any.whl | Python 3 | none | any | Details for api_to_dataframe-2.2.3-py3-none-any.whl |
Total release size: 11.4 kB
Release files / api_to_dataframe-2.2.3.tar.gz
| Download URL | api_to_dataframe-2.2.3.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
78b9a488be6431507e3b23be6c015d97267bf2f16569fb67b6bc31f0116370cb
|
|
BLAKE2b-256 checksum How to use checksums |
6ad7ff9049625ec2043bf8689e48e8030118446b988b1a106b472125abe43799
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.5.1 CPython/3.10.22 Linux/7.0.0-1017-azure
|
Release files / api_to_dataframe-2.2.3-py3-none-any.whl
| Download URL | api_to_dataframe-2.2.3-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c042d18a894513d0618ded352b81baa14cf0f70a19fd39fb876f67a76c18492f
|
|
BLAKE2b-256 checksum How to use checksums |
62480f17ef03e74df41a2418e797c2b45652e376047c2e31dea18a2047a001f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.5.1 CPython/3.10.22 Linux/7.0.0-1017-azure
|
Security for api-to-dataframe 2.2.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.