Async PoE API client with rate limit support (upcoming)
Project description
poe-client
Async PoE API client with rate limit support.
Updated for Scourge League.
WARNING
This project is in an pre-alpha stage and has not been tested properly in production. Use with caution.
Features
- Asynchronous HTTP client based on aiohttp
- Up-to-date with all PoE API endpoints
- All PoE API types defined as Pydantic schemas (Can generate OpenAPI Specifications)
- 100% test coverage and style enforced with wemake's flake8
- Fully typed with pydantic and checked with mypy, PEP561 compatible
Limitations
There is no API endpoint only to fetch rate limit headers. This means that the Client is not aware of what rules exist until it makes a real request. Thus, be aware that sending too many request at the same time leads to being rate limited. Try to batch by 5, we've seen this as a safe level of concurrency.
Installation
pip install poe-client
Example
Showcase how your project can be used:
from typing import List
import os
from poe_client.client import Client, PoEClient
from poe_client.schemas.league import League
token = os.environ["POE_TOKEN"]
contact = os.environ["POE_CONTACT"]
if not token or not contact:
raise EnvironmentError("Need to set both POE_TOKEN and POE_CONTACT")
client = PoEClient(
token,
"poe-client",
"1.0",
contact,
)
async def list_leagues():
"""List leagues."""
leagues: List[League] = []
async with client:
leagues = await client.list_leagues()
logging.info(leagues)
License
Credits
This project was generated with wemake-python-package
. Current template version is: 6cb0736bbc9cb53ee126e2297b8ed7029b5e1380. See what is updated since then.
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 poe-client-0.5.1.tar.gz
.
File metadata
- Download URL: poe-client-0.5.1.tar.gz
- Upload date:
- Size: 14.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.8.10 Linux/5.10.102.1-microsoft-standard-WSL2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 193db02a76b7511fbe533311ea2f1baf1fc4ec604c246c2406c03cc8bc49aa99 |
|
MD5 | 39e15098ef2874bbd2a2692b8492c899 |
|
BLAKE2b-256 | 4dedcc7a58ac127083089a185e53d198a493d8b3c8b4f4f19ede4b45205825c9 |
File details
Details for the file poe_client-0.5.1-py3-none-any.whl
.
File metadata
- Download URL: poe_client-0.5.1-py3-none-any.whl
- Upload date:
- Size: 15.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.8.10 Linux/5.10.102.1-microsoft-standard-WSL2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b0c0e37bf9c0aa9ae9598a80f6d37f91e7d2882f9e74ea8e22391248bf5bed0 |
|
MD5 | dd6f3f52e2012c531cf84ab2c956138e |
|
BLAKE2b-256 | ad2aa14f4f148d4d221bc61626c4ae339802b66b3ebd18e033894bf5ead9364e |