Skip to main content

Extra Async Support for LINE Messaging API SDK

Project description

PyPI - Version PyPI - Status PyPI - Python Version PyPI - License Code Style - Black Ko-fi - Donate

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()

See aiohttp.ClientSession.close().

Timeout

To set a timeout you can pass aiohttp.ClientTimeout object instead of numeric value.

Examples

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

line-bot-sdk-extra-0.1.0.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

line_bot_sdk_extra-0.1.0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file line-bot-sdk-extra-0.1.0.tar.gz.

File metadata

  • Download URL: line-bot-sdk-extra-0.1.0.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.9.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for line-bot-sdk-extra-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7c8aa883c61917ddd509edc449a8902a612aeb92ac894897f05e5aaa8ae1c545
MD5 fcd34a0b22cabe917f8668b315c2bba9
BLAKE2b-256 e4635ea709867b2c33ec006ad66b8831ed737186c03c544b7e85139080f80927

See more details on using hashes here.

File details

Details for the file line_bot_sdk_extra-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: line_bot_sdk_extra-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.9.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for line_bot_sdk_extra-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f926a9bde5d19a939cee9975c031e8c5ebc20a228bf4c97be7c631e93c0beef7
MD5 68fed5f25510b120039c75cbe0e63ac2
BLAKE2b-256 6b4dd1a81171be058d18f16cc6678ece26aec5472d24ff40eda1cd81b79f5c96

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page