This release is a pre-release and may not be stable for production use.
Python Async API Client
This have in mind to start developing API clients for Home Assistant to be 100% asynchronous
How to Use it?
Fork this repository by using it as a template.
Structure
This package provides good defaults for any API client code that is split on the following modules:
errors.py: module that define the custom errors the API and/or client would be returning to their users.model.py: definition of the API data model. All returned objects from the clients would be defined here.client.py: the logic around calling the API
Development
To start developing with this package, fork it, create a virtual environment and install all the dependencies needed for development.
python3 -m venv .venv
source .venv/bin/activate
pip install '.[dev]'
Best Practices
This package provides already an skeleton with some best practices when starting developing your API client.
- 100% async from the start: Home Assistant runs its main logic using an asynchronous engine, and having 3rd party clients running async can have performance benefits and ease of integration on new and existing components.
- A
aiohttp.ClientSessionshould always to be a constructor argument (so a session and connection pool can be shared between multiple clients). The template already provides a class constructor to create the Client without any initialClientSessionin case it is not available. - The output of each API endpoint is a typed
Modelthat is build as a dataclass and can be parsed from a JSON response or a nested dictionary. This ensures the consumer of the API outputs can take benefits from the benefits dataclasses provide like readaibility on its structure and field types. - The whole library is annotated with Python types so type checkers can help us detect errors early on rather than at runtime.
Metadata
Release files for project-async 0.0.1rc105.post1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| project_async-0.0.1rc105.post1.tar.gz | 10.3 kB | Without provenance | Details for project_async-0.0.1rc105.post1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| project_async-0.0.1rc105.post1-py3-none-any.whl | Python 3 | none | any | Details for project_async-0.0.1rc105.post1-py3-none-any.whl |
Total release size: 15.4 kB
Release files / project_async-0.0.1rc105.post1.tar.gz
| Download URL | project_async-0.0.1rc105.post1.tar.gz |
|---|---|
| Size | 10.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e0298d8c7faf61e991067ac69ef1d7d43ded035c256a00199efce8fdf3ccbb0c
|
|
BLAKE2b-256 checksum How to use checksums |
2706924cd9284a82bc0f37ef51a8eceaaebcbcfc05b30493ad20a9a9304317c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.32.3
|
Release files / project_async-0.0.1rc105.post1-py3-none-any.whl
| Download URL | project_async-0.0.1rc105.post1-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4354e2a927c3c74a404f34b9e7e1c31a202274ff380545925281c49df10f89a1
|
|
BLAKE2b-256 checksum How to use checksums |
b91c4ce7d7e88154bd8846729fd3f110232adc2f54ff5e6f0c7ab3d3dcdac67f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.32.3
|
Security for project-async 0.0.1rc105.post1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.