/aiowc

Asynchronous python wrapper for WooCommerce REST API

Primary LanguagePythonMIT LicenseMIT

aiowc - Asynchronous Python Client

Asynchronous Python wrapper for WooCommerce REST API.

Gives you asynchronous access to the REST API. Based on aiohttp and wc-api-python.

PRs are highly appreciated!

Installation

pip install aiowc or pip install "git+https://github.com/vakochetkov/aiowc"

Getting started

from aiowc import API, APISession
  • Set API parameters:
wcapi = API(
    url="https://example.com",
    consumer_key="ck_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    consumer_secret="cs_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    version="wc/v3",
    timeout=30
)
  • Make request with aiohttp session:
async def main():
    async with APISession(wcapi) as session:
        res = await session.get('products/categories', params={'per_page': 5})
        json = await res.json()
        print(json)

loop = asyncio.get_event_loop()
loop.run_until_complete(main())

Options and request types:

Fully compatible with wc-api-python