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.
Project Stack
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
Release history Release notifications | RSS feed
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)
Built Distribution
Close
Hashes for api_to_dataframe-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b0f09a2bbcae006eecf145545a2ae3ff30d8faa9363cf17347f3a1eef7f6767 |
|
MD5 | b8b29d70cf076b6b4ecf0a61f704745f |
|
BLAKE2b-256 | 7714f5205021788c0bcf073a34a921f534a81c24c7e669a05c54f506df51aea3 |