Skip to content

Commit

Permalink
✨ Add example of usage polling
Browse files Browse the repository at this point in the history
  • Loading branch information
GLEF1X committed May 13, 2021
1 parent 0820d49 commit d88e443
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ asyncio.run(main())

```

## 🌟Webhooks & handlers
## 🌟Webhooks / polling & handlers

```python
import logging
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d88e443

Please sign in to comment.