🤖 line-bot-sdk-python-extra
Extra feature for LINE Messaging API SDK for Python.
Installation
pip install line-bot-sdk-extra
or:
python setup.py install
To use the package:
>>> import linebotx
Features
Asynchronous API
Allows you to write non-blocking code which makes your bot respond much faster with little changes.
Synchronous:
from linebot import LineBotApi, WebhookHandler
line_bot_api = LineBotApi('YOUR_CHANNEL_ACCESS_TOKEN')
handler = WebhookHandler('YOUR_CHANNEL_SECRET')
Asynchronous:
from linebotx import LineBotApiAsync, WebhookHandlerAsync
line_bot_api = LineBotApiAsync('YOUR_CHANNEL_ACCESS_TOKEN')
handler = WebhookHandlerAsync('YOUR_CHANNEL_SECRET')
Equivalent Counterpart
linebotx |
linebot |
|---|---|
LineBotApiAsync |
LineBotApi |
AioHttpClient |
HttpClient |
AioHttpResponse |
HttpResponse |
WebhookHandlerAsync |
WebhookHandler |
NOTE: Every public method is coroutine and should be awaited. For example:
@app.route("/callback", methods=['POST'])
async def callback():
...
await handler.handle(body, signature)
...
@handler.add(MessageEvent, message=TextMessage)
async def handle_message(event):
await line_bot_api.reply_message(
event.reply_token,
TextSendMessage(text=event.message.text))
Additional Methods
- coroutine
LineBotApiAsync.close() Close underlying http client.
- coroutine
AioHttpClient.close()
Timeout
To set a timeout you can pass aiohttp.ClientTimeout object instead of numeric value.
Examples
sanic-echo - Sample echo-bot using sanic.
Contributing
If you would like to contribute, please check for open issues or open a new issue if you have ideas, changes, or bugs to report.
References
This project is just a small addition to the original SDK, please refer to line-bot-sdk-python or the docs.
Metadata
Release files for line-bot-sdk-extra 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| line-bot-sdk-extra-0.1.2.tar.gz | 8.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| line_bot_sdk_extra-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.6 kB
Release files / line-bot-sdk-extra-0.1.2.tar.gz
| Download URL | line-bot-sdk-extra-0.1.2.tar.gz |
|---|---|
| Size | 8.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2ff4f909fbb254d56a78d84a223f3f06c0388b056ae67be4fe297b91018162b3
|
|
BLAKE2b-256 checksum How to use checksums |
08d51273e7eff70b309afd914e86f07cb55918ab2e7a10137920644ece9d385d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.4
|
Release files / line_bot_sdk_extra-0.1.2-py3-none-any.whl
| Download URL | line_bot_sdk_extra-0.1.2-py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
edbe57f28652639de9b6dc5de7be45c8d8cb155f3bdc5dff07050700e39785f7
|
|
BLAKE2b-256 checksum How to use checksums |
67bf7dfcee2c8b4c650d94bda88eaadbabfb0937fac1552a42d6a624bfff9b96
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.4
|