Skip to main content

Async PoE API client with rate limit support (upcoming)

Project description

poe-client

Build Status codecov Python Version wemake-python-styleguide

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

MIT

Credits

This project was generated with wemake-python-package. Current template version is: 6cb0736bbc9cb53ee126e2297b8ed7029b5e1380. See what is updated since then.

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

poe-client-0.5.1.tar.gz (14.1 kB view details)

Uploaded Source

Built Distribution

poe_client-0.5.1-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

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

Hashes for poe-client-0.5.1.tar.gz
Algorithm Hash digest
SHA256 193db02a76b7511fbe533311ea2f1baf1fc4ec604c246c2406c03cc8bc49aa99
MD5 39e15098ef2874bbd2a2692b8492c899
BLAKE2b-256 4dedcc7a58ac127083089a185e53d198a493d8b3c8b4f4f19ede4b45205825c9

See more details on using hashes here.

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

Hashes for poe_client-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9b0c0e37bf9c0aa9ae9598a80f6d37f91e7d2882f9e74ea8e22391248bf5bed0
MD5 dd6f3f52e2012c531cf84ab2c956138e
BLAKE2b-256 ad2aa14f4f148d4d221bc61626c4ae339802b66b3ebd18e033894bf5ead9364e

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