Skip to content

BPL-Development-Team/poe-client

Repository files navigation

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.

About

PoE API client with rate limit support

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published