Skip to main content

A package to convert API responses to pandas dataframe

Project description

API to DataFrame

Your solution to convert API responses to Pandas DataFrames with retry strategies and detailed reports.

Github

PyPI - Status PyPI - Downloads PyPI - Version

PyPI - Python Version

CI CD

Codecov

Project Stack

Python  Docker  Poetry  GitHub Actions  CodeCov  pypi  pandas  pytest 

Library Description

Python library that simplifies obtaining data from API endpoints by converting them directly into Pandas DataFrames. This library offers robust features, including retry strategies for failed requests and automatic generation of detailed reports on the received data.

Installation

To install the package using pip, use the following command:

pip install api-to-dataframe

To install the package using poetry, use the following command:

poetry add api-to-dataframe

How to use it

## Importing library
from api_to_dataframe import ClientBuilder, RetryStrategies

# Create a client for simple ingest data from API (timeout 5 seconds)
client = ClientBuilder(endpoint="https://api.example.com")

# if you can define timeout, use: (default is 5 seconds), with LinearStrategy (In development, actually don't nothing) and set headers:
headers = {
    "application_name": "api_to_dataframe"
}
client = ClientBuilder(endpoint="https://api.example.com"
                        ,retry_strategy=RetryStrategies.LinearStrategy
                        ,timeout=10
                        ,headers=headers)

### timeout, retry_strategy and headers are opcionals parameters 

# Get data from the API
data = client.get_api_data()

# Convert the data to a DataFrame
df = client.api_to_dataframe(data)

# Display the DataFrame
print(df)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

api_to_dataframe-1.1.0.tar.gz (4.1 kB view hashes)

Uploaded Source

Built Distribution

api_to_dataframe-1.1.0-py3-none-any.whl (5.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page