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!
pip install aiowc
or pip install "git+https://github.com/vakochetkov/aiowc"
- Generate API credentials
- Import aiowc:
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())
Fully compatible with wc-api-python