Skip to main content

API to DataFrame

Fetch JSON from any HTTP API and turn it into a pandas DataFrame in two calls — with optional retry strategies.

PyPI - Version PyPI - Downloads PyPI - Python Version CI Codecov

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 — wait initial_delay seconds before each retry.
  • EXPONENTIAL_RETRY_STRATEGY — wait initial_delay * retry_number seconds before each retry.

Retries are capped at 5 regardless of the retries value.

Metadata

Release files for api-to-dataframe 2.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for api-to-dataframe 2.2.1
File Size Uploaded
api_to_dataframe-2.2.1.tar.gz 4.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for api-to-dataframe 2.2.1
File Interpreter ABI Platform
api_to_dataframe-2.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 11.4 kB

Release files / api_to_dataframe-2.2.1.tar.gz

Download URL api_to_dataframe-2.2.1.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1d5fa3d1db29b9b91b5f4227f26fb1062e93d8e509bf61cf06de7fbb0ade8bd9
BLAKE2b-256 checksum
How to use checksums
34c6ba05c9cffad80ca7700c74b35cc2b37145b51734d6e70111787c358f164e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.10.21 Linux/6.17.0-1022-azure

Release files / api_to_dataframe-2.2.1-py3-none-any.whl

Download URL api_to_dataframe-2.2.1-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eefa96840b8ffc1a3ee037a86bc5582c1ccdb9431d28d768df4c798e1c1391e5
BLAKE2b-256 checksum
How to use checksums
7dbb4929422d73f26e5c7bd8c71e09ee9d90f7766e5f1d22eda39ff346a39d2f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.10.21 Linux/6.17.0-1022-azure

Release history Release notifications | RSS feed

2.2.2

2 release files

This release

2.2.1 This release

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.6

2 release files

2.0.5

2 release files

2.0.4

2 release files

2.0.3

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.5.2

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.13

2 release files

1.3.11

2 release files

1.3.10

2 release files

1.3.4

2 release files

1.3.3

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.0

2 release files

0.0.11

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page