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
Built Distribution
File details
Details for the file api_to_dataframe-1.1.0.tar.gz
.
File metadata
- Download URL: api_to_dataframe-1.1.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.9.19 Linux/6.5.0-1021-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31fecdf717b1572250794979381ac6643b8e591ff9a7f151b80e8b9187890e3f |
|
MD5 | 6202922352f162b46f4865652ad561c4 |
|
BLAKE2b-256 | 7ca0c4319eda4029e47f78463fddd950156230a5b573cbab27b206de87d35272 |
File details
Details for the file api_to_dataframe-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: api_to_dataframe-1.1.0-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.9.19 Linux/6.5.0-1021-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b0f09a2bbcae006eecf145545a2ae3ff30d8faa9363cf17347f3a1eef7f6767 |
|
MD5 | b8b29d70cf076b6b4ecf0a61f704745f |
|
BLAKE2b-256 | 7714f5205021788c0bcf073a34a921f534a81c24c7e669a05c54f506df51aea3 |