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.2

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.2
File Size Uploaded
api_to_dataframe-2.2.2.tar.gz 4.9 kB Details

Built distribution (wheel)

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

Total release size: 11.5 kB

Release files / api_to_dataframe-2.2.2.tar.gz

Download URL api_to_dataframe-2.2.2.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
5721cd24a7c0e0b160e346666384450605abcf069023a1b51992b19a179bd614
BLAKE2b-256 checksum
How to use checksums
90e258eb7ee8f1797f3fe7bff464f3865f960b25c0f64fd81cb6a678f9582270
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.2-py3-none-any.whl

Download URL api_to_dataframe-2.2.2-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6a95a01df7bf7b42c06d31adce3668023d26f1e07d21e0f9557b3a2a6e34323d
BLAKE2b-256 checksum
How to use checksums
d577559b9e38a20e663205efb5c21f3f24638d7eff16184a174d1d40b15ef8aa
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

This release

2.2.2 This release

2 release files

2.2.1

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