diff --git a/README.md b/README.md index 7fece638..03ebb4cc 100644 --- a/README.md +++ b/README.md @@ -172,7 +172,7 @@ asyncio.run(main()) ``` -## 🌟Webhooks & handlers +## 🌟Webhooks / polling & handlers ```python import logging @@ -205,6 +205,36 @@ wallet.start_webhook( ``` +## 🧑🏻‍🔬Polling updates +```python +import datetime + +from glQiwiApi import QiwiWrapper, types + +api_access_token = "your token" +phone_number = "your number" + +wallet = QiwiWrapper( + api_access_token=api_access_token, + phone_number=phone_number +) + + +@wallet.transaction_handler() +async def my_first_handler(update: types.Transaction): + assert isinstance(update, types.Transaction) + + +def on_startup(wrapper: QiwiWrapper): + wrapper.dispatcher.logger.info("This message logged on startup") + + +wallet.start_polling( + get_updates_from=datetime.datetime.now() - datetime.timedelta(hours=1), + on_startup=on_startup +) +``` + ## 💳Send to card & check commission ```python