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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

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