Skip to main content

Using Line Notify more easily

Project description

Lotify - LINE Notify client SDK

License: MIT PRs Welcome

Lotify is a LINE Notify client SDK that you can build Notify bot quickly.

Usage

Version suggest >= 3.7

You need a LINE account and create a Notify like this:

create-a-line-notify

Install package

pip install lotify

initialize instance

from lotify.client import Client

client = Client(
    client_id='YOUR_CLIENT_ID',
    client_secret='YOUR_CLIENT_SECRET',
    redirect_uri='YOUR_URI'
)

Get access token

access_token = client.get_access_token(code='NOTIFY_RESPONSE_CODE')
print(access_token)
# N6g50DiQZk5Xh...25FoFzrs2npkU3z

Get Status

status = client.status(access_token='YOUR_ACCESS_TOKEN')
print(status)
# {'status': 200, 'message': 'ok', 'targetType': 'USER', 'target': 'NiJia Lin'}

Send message

push-notify
response = client.send_message(access_token='YOUR_ACCESS_TOKEN', message='This is notify message')
print(response)
# {'status': 200, 'message': 'ok'}

Send message with Sticker

push-notify-with-sticker

You can find stickerId and stickerPackageId here

response = client.send_message_with_sticker(
    access_token='YOUR_ACCESS_TOKEN',
    message='This is notify message',
    sticker_id=1,
    sticker_package_id=1)
print(response)
# {'status': 200, 'message': 'ok'}

Send message with Image path

send-message-with-image-path
image = client.send_message_with_image_path(
    access_token='YOUR_ACCESS_TOKEN',
    message='This is notify message',
    image_path='./test_image.png'
)
print(image)
# {'status': 200, 'message': 'ok'}

Send message with Image url

send-message-with-image-url
image = client.send_message_with_image_url(
    access_token='YOUR_ACCESS_TOKEN',
    message='This is notify message',
    image_thumbnail='https://i.imgur.com/RhvwZVm.png',
    image_fullsize='https://i.imgur.com/RhvwZVm.png',
)
print(image)
# {'status': 200, 'message': 'ok'}

Revoke access token

revoke-line-notify-token
revoke = client.revoke(access_token='YOUR_ACCESS_TOKEN')
print(revoke)
# {'status': 200, 'message': 'ok'}

Contributing

Fork before Clone the repository:

git clone git@github.com:your-username/line-notify.git

First install for development.

pip install -r requirements-dev.txt

Run pytest to make sure the tests pass:

cd line-notify/
python -m pytest --flake8 tests/

If you fix README by markdown, you can use Online Converter to format to reStructuredText (RST) and run make check to valid README🙂.

License

MIT © NiJia Lin & Duncan Huang

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

lotify-1.1.4.tar.gz (7.0 kB view details)

Uploaded Source

File details

Details for the file lotify-1.1.4.tar.gz.

File metadata

  • Download URL: lotify-1.1.4.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.7

File hashes

Hashes for lotify-1.1.4.tar.gz
Algorithm Hash digest
SHA256 4f484742d44de400248abe13899711ef2bcb2c97c8bf6f8fc5157b3b2bbe9473
MD5 c48427c5b425e0fc88b4a7ad4eead161
BLAKE2b-256 b1bcc29985583f1869a3dcaf66034e5772aefe0fb3764df663cd500a85ce7e77

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