Skip to main content

The `abstract_apis` module is designed to facilitate HTTP requests in Python applications, particularly those that require handling JSON data, dealing with custom API endpoints, and parsing complex nested JSON responses. The module simplifies request handling by abstracting away common tasks such as header management, URL construction, and response parsing.

Project description


Abstract APIs

The abstract_apis module is designed to facilitate HTTP requests in Python applications, particularly those that require handling JSON data, dealing with custom API endpoints, and parsing complex nested JSON responses. The module simplifies request handling by abstracting away common tasks such as header management, URL construction, and response parsing.

Features

  • Header Management: Automatically prepares headers suitable for JSON requests.
  • URL Construction: Helps in constructing URLs by cleanly appending endpoints to base URLs.
  • Nested JSON Parsing: Capable of parsing deeply nested JSON responses automatically to facilitate easy data extraction.
  • Flexible Response Handling: Offers functions to handle both raw and parsed JSON responses based on user preference.
  • Error Handling: Provides robust error reporting to aid in troubleshooting issues during HTTP requests.

Installation

This module is not yet available on PyPI. To install, you can clone the repository and install it manually:

git clone https://github.com/AbstractEndeavors/abstract_apis.git
cd abstract_apis
python setup.py install

Usage

Making a GET Request

from abstract_apis import getGetRequest

url = 'https://api.example.com'
endpoint = 'data'
params = {'key': 'value'}
response = getGetRequest(url, data=params, endpoint=endpoint)
print(response)

Making a POST Request

from abstract_apis import getPostRequest

url = 'https://api.example.com'
endpoint = 'submit'
data = {'key': 'value'}
response = getPostRequest(url, data=data, endpoint=endpoint)
print(response)

Handling Nested JSON

The module automatically parses nested JSON responses if enabled:

response = getGetRequest(url, data=params, endpoint=endpoint, load_nested_json=True)
print(response)

Dependencies

  • Python 3.6 or higher
  • requests library

Make sure you have the requests library installed:

pip install requests

Contributions

Contributions are welcome. Please fork the repository, make your changes, and submit a pull request on GitHub.

Contact

For any questions or to discuss potential partnerships, please email partners@abstractendeavors.com.

Contributions

Contributions are welcome! Please fork the repository on GitHub and submit a pull request with your changes.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.


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

abstract_apis-0.0.0.55.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

abstract_apis-0.0.0.55-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file abstract_apis-0.0.0.55.tar.gz.

File metadata

  • Download URL: abstract_apis-0.0.0.55.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for abstract_apis-0.0.0.55.tar.gz
Algorithm Hash digest
SHA256 d2fb4ddbbad0480039f82a850c9bb1e5c1f51b0fad7c471d68adeea4456be556
MD5 b540660f1e8d0d14fe73334394cde9a7
BLAKE2b-256 6ae60f86903c8fda3f253a1f4899f2b213f9b2d59ebd5f25cea6f502171995c4

See more details on using hashes here.

File details

Details for the file abstract_apis-0.0.0.55-py3-none-any.whl.

File metadata

File hashes

Hashes for abstract_apis-0.0.0.55-py3-none-any.whl
Algorithm Hash digest
SHA256 fd0e5ae6bde4cf4aaf5aae6d875bf5d982cd7b259849289a96e18163cff2e5e5
MD5 07365a69cd244cb52922a4b1192409a2
BLAKE2b-256 61192c41d7298b3017dcf020e9c405076ef0268e2bb2df5cd725297bb55d6c59

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