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

User Guide

## Importing library
from api_to_dataframe import ClientBuilder, RetryStrategies

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

# if you can define timeout with LinearStrategy and set headers:
headers = {
    "application_name": "api_to_dataframe"
}
client = ClientBuilder(endpoint="https://api.example.com"
                        ,retry_strategy=RetryStrategies.LinearStrategy
                        ,connection_timeout=2
                        ,headers=headers)

"""
    NOTE: by default the quantity of retries is 3 and the time between retries is 1 second, but you can define manually, like this:
    
"""

client = ClientBuilder(endpoint="https://api.example.com"
                        ,retry_strategy=RetryStrategies.LinearStrategy
                        ,connection_timeout=10
                        ,headers=headers
                        ,retries=5
                        ,delay=10)
 

### 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.2.1.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

api_to_dataframe-1.2.1-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file api_to_dataframe-1.2.1.tar.gz.

File metadata

  • Download URL: api_to_dataframe-1.2.1.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.9.19 Linux/6.5.0-1022-azure

File hashes

Hashes for api_to_dataframe-1.2.1.tar.gz
Algorithm Hash digest
SHA256 a4f4493d5049b80e38969c57ab0b2219fbce674f78b0ef0b762e7de9c67cf6c2
MD5 6ac0b1adcd2bc3bf3ed217dd01775c90
BLAKE2b-256 fc4562ff522040047433543bccba3d00ec3926a23bad199d5f9671ae224ecc37

See more details on using hashes here.

File details

Details for the file api_to_dataframe-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: api_to_dataframe-1.2.1-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-1022-azure

File hashes

Hashes for api_to_dataframe-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6000501e16f640f53cb82747b9fa8656a861472d6a160811ab0ea9fe5d3b6226
MD5 753471493dd8d169c03b3f0c0d9fe8f6
BLAKE2b-256 c79f241b010b6a3246cd62d12996fa98c8bdd0f1f253e410ced7bbe31322001a

See more details on using hashes here.

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