Matter's API Client Library
Project description
matter-api-client
Table of Contents
Background
The Matter API Client Library in Python is a comprehensive tool for making HTTP/HTTPS API calls to other web services. It is designed to simplify the process of making API calls and handling the responses. The library supports both synchronous and asynchronous operations, allowing developers to choose the best approach for their use case.
One of the key features of the library is its ability to send JSON payloads, making it easy to work with APIs that require JSON data. It also automatically parses JSON responses, saving developers time and effort.
The library is designed with reliability in mind. It includes built-in error handling to catch client connection errors and throw exceptions when necessary. This ensures that developers can quickly identify and fix issues that may arise during API calls.
To further improve reliability, the library includes auto-retry functionality. This means that if an API call fails due to a network issue or other transient error, the library will automatically retry the call. This helps to ensure that the application can continue to function even in the face of occasional network disruptions.
Overall, the Python API Client Library is a powerful and flexible tool that can help developers to quickly and easily integrate with a wide range of APIs. With support for JSON payloads, automatic parsing of responses, error handling, and auto-retries, it is a reliable and robust solution for any project that requires API integration.
Installation
pip install matter-api-client
Also, make sure to set the following ENV variables:
SERVER_LOG_LEVEL=debug or info or error
Usage
Sync API Calls:
Get:
from matter_api_client.http_client import get
result = get(url="some url")
Post:
from matter_api_client.http_client import post
result = post(url="some url", payload=payload, headers=headers)
Put:
from matter_api_client.http_client import put
result = put(url="some url", payload=payload, headers=headers)
Delete:
from matter_api_client.http_client import delete
result = delete(url="some url", payload=payload, headers=headers)
Async API Calls:
Get:
from matter_api_client.http_client_async import get
result = await get(url="some url")
Post:
from matter_api_client.http_client_async import post
result = await post(url="some url", payload=payload, headers=headers)
Put:
from matter_api_client.http_client_async import put
result = await put(url="some url", payload=payload, headers=headers)
Delete:
from matter_api_client.http_client_async import delete
result = await delete(url="some url", payload=payload, headers=headers)
Contributing
Make sure you have all supported python versions installed in your machine:
- 3.10
- 3.11
Install hatch in your system
https://hatch.pypa.io/latest/install/
Create the environment
hatch env create
Do your changes...
Run the tests
hatch run test
The command above will run the tests against all supported python versions installed in your machine. For testing in other operating system you may use the configured CI in github.
Bump a new version
In general, you just need to execute:
hatch version
This command will update the minor version. i.e.: No breaking changes and new feature has been added
We are using semantic version, if you are doing a bug fix:
hatch version fix
Github workflows
If you want to reuse fully the github actions defined by this template make sure your workflow permissions for Actions settings is configured as followed:
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 Distributions
Built Distribution
File details
Details for the file matter_api_client-1.2.0-py3-none-any.whl
.
File metadata
- Download URL: matter_api_client-1.2.0-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c771bddae4278c61d47752b671644925955ae98e087a395083f55d0600ef499f |
|
MD5 | 14c03f2b496499ac439039a7cb3cbf49 |
|
BLAKE2b-256 | 26079da23424e9c33b0819987923f8601c9316176ffe7f4d309cf627e6b2a18d |