Skip to main content

Using Line Notify more easily

Project description

Lotify - LINE Notify client SDK

License: MIT PRs Welcome

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

Usage

You need a LINE account and create a Notify like this: create-a-line-notify

initialize instance

from line_notify.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

Just message

push-notify

push-notify

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

push-notify-with-sticker

With sticker, image_path, thumbnail or fullsize image

You can find stickerId and stickerPackageId here

# push message with sticker or image
response = client.send(access_token='YOUR_ACCESS_TOKEN', params={
    'message': 'This is notify message',
    'stickerPackageId': '1',
    'stickerId': '1',
    # image_path='./test_image.png',
    # image_thumbnail='https://i.imgur.com/RhvwZVm.png',
    # image_fullsize='https://i.imgur.com/RhvwZVm.png',
})
print(response)
# {'status': 200, 'message': 'ok'}

Revoke access token

revoke-line-notify-token

revoke-line-notify-token

from line_notify.client import Client

client = Client()
revoke = client.revoke(access_token='CKmvd81Yfd9Xv38ayQdt7JN4H90oQrP6srFmKckx3sL')
print(revoke)
# {'status': 200, 'message': 'ok'}

Contributing

Fork before Clone the repository: shell script git clone git@github.com:your-username/line-notify.git

Run pytest to make sure the tests pass: shell script cd line-notify/ python -m pytest tests/ # License MIT License

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.0.tar.gz (7.2 kB view details)

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for lotify-1.1.0.tar.gz
Algorithm Hash digest
SHA256 3a279dd51c77abf621863a0bf6f8e5ed6e4c2997eeb0cc34f1a690b35194cd04
MD5 a3ce2d037b33e5c0dcaf66d701b3badd
BLAKE2b-256 3f604f22d789ceaa263c8a2b8644eb7af92fb510f266756fe002c7015fe70dc5

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