A package for accessing APIs used by the data team
Project description
aerapi aerapi is a Python package designed for accessing and interacting with APIs used by the data team at Aerlytix. It provides robust utilities to connect with external and internal APIs, manage authentication, and streamline data retrieval and manipulation.
Features External API Integration: Simplifies interactions with external APIs. Internal API Support: Streamlined methods for internal data systems. Authentication: Built-in utilities to handle API authentication (e.g., API keys, secrets). Configuration: YAML-based configuration for managing environments and credentials. Extensible: Easily add new API endpoints and customize behavior. Installation Install the package directly from PyPI:
bash Copy code pip install aerapi Or install it from source:
bash Copy code git clone https://github.com/stelltec/aerapi.git cd aerapi pip install . Usage Quickstart Import the Library:
python Copy code from aerapi.external.api_client import ExternalApiClient from aerapi.internal.api_client import InternalApiClient Set Up Configuration: Prepare a configuration file (e.g., config.yaml):
yaml Copy code environments: demo: - name: "external_api" api_key: "your-demo-api-key" secret_key: "your-demo-secret-key" preprod: - name: "internal_api" api_key: "your-preprod-api-key" secret_key: "your-preprod-secret-key" Initialize Clients:
python Copy code from aerapi.common.config_utils import load_config
Load the configuration
config = load_config("config.yaml")
Initialize API clients
external_client = ExternalApiClient(config["demo"]["external_api"]) internal_client = InternalApiClient(config["preprod"]["internal_api"]) Make API Calls:
python Copy code
Example: Fetch external API data
data = external_client.get_data(endpoint="/example") print(data)
Example: Submit data to internal API
response = internal_client.post_data(endpoint="/submit", payload={"key": "value"}) print(response) Folder Structure common/: Shared utilities, including authentication and configuration tools. external/: Methods and utilities for interacting with external APIs. internal/: Methods and utilities for interacting with internal APIs. config/: Contains example configuration files. tests/: Unit tests for the package. Requirements The package has the following dependencies:
requests PyYAML jsonschema These will be installed automatically during the package installation.
Testing Run the tests to ensure everything works as expected:
bash Copy code pytest tests/ Contributing Contributions are welcome! Please follow these steps:
Fork the repository. Create a new branch (feature-branch). Make your changes and commit them. Submit a pull request. License This project is licensed under the MIT License. See the LICENSE file for more details.
Contact For questions or support, please contact:
S. Nicholson 📧 Sean.Nicholson@aerlytix.com
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 aerapi-0.1.8.tar.gz
.
File metadata
- Download URL: aerapi-0.1.8.tar.gz
- Upload date:
- Size: 29.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 35bd12f87e8908cbaa9694e60e02b5309f0d75e5eb8dce5bfb0ec7385023db19 |
|
MD5 | 2a11357bd527d203cf330fd0d1f5bbac |
|
BLAKE2b-256 | 7c88cfef3641bf1ea9fac2db6eb7643a820a7912aaf6873e1180d1e53519be06 |
File details
Details for the file aerapi-0.1.8-py3-none-any.whl
.
File metadata
- Download URL: aerapi-0.1.8-py3-none-any.whl
- Upload date:
- Size: 32.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 276d86a1f1808a8fa02d4a90dc69a6a2f06a68bf562f792f279262ada3b8381d |
|
MD5 | e1e8437d26f54da21c166212ed0c067e |
|
BLAKE2b-256 | 87492e99b383c085e98d446512ad7f6de5fbdf8084cd57774290fd4a9e1c502c |