Skip to main content

May the LINE be with you...

Project description

|PyPi version| |PyPi downloads|

2014.08.06 UPDATE : sticker can be send!!! 2014.08.04 ANNOUNCE : This project is not completed yet :(

May the LINE be with you…

>>> from line import LineClient
>>> client = LineClient("carpedm20", "xxxxxxxxxx")
Enter PinCode '9779' to your mobile phone in 2 minutes
>>> client = LineClient("carpedm20@gmail.com", "xxxxxxxxxx")
Enter PinCode '7390' to your mobile phone in 2 minutes
>>> print client.profile

Installing

First, you need to install Apache Thrift. Install instructions are here. (This might take some time…)

Next:

$ pip install line

Or, you can use:

$ easy_install line

Or, you can also install manually:

$ git clone git://github.com/carpedm20/line.git
$ cd LINE
$ python setup.py install

Using

First, you need to create a LineClinet object with YOUR_ID and YOUR_PASSWORD. YOUR ID can be LINE email address or NAVER id.

>>> from line import LineClient
>>> client = LineClient(YOUR_ID, YOUR_PASSWORD)
Enter PinCode '9779' to your mobile phone in 2 minutes

After you enter PinCode to your mobile phone, you will get authToken.

>>> authToken = client.authToken
>>> print authToken

With authToken, you don’t have to enter PinCode to your phone anymore!

>>> client = LineClient(authToken=authToken)
>>> print client.profile

View contacts and groups

You can see your contacts by:

>>> print client.contacts  # your friends
>>> print client.groups

Send a message

You can send a message by:

>>> client.contacts[0].sendMessage("test")
True
>>> client.groups[0].sendMessage("test")
True

Send a sticker

You can send a sticker by:

>>> client.contacts[0].sendSticker(stickerId="1",stickerPackageId="1",stickerVersion="100")
True
>>> client.groups[0].sendMessage(stickerId="1",stickerPackageId="1",stickerVersion="100")
True

Get a list of recent message

You can read a recent message from contact or gruop by:

>>> messages = client.contacts[0].getRecentMessages(count=10)
>>> messages = client.groups[0].getRecentMessages(count=1)

Refresh contacts and groups

If there is any change of contacts. you need to update contacts by:

>>> client.refreshContacts()
True
>>> client.refreshGroups()
True

Screenshot

alt\_tag

Todo

  • Long poll feature

  • Send a Image file

  • Send a sticker… (strongly needed)

  • Make a echo bot example… (this is my major goal right now)

  • More usable methods and objects

License

Source codes are distributed under BSD license.

Author

Taehoon Kim / @carpedm20

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

Uploaded Source

File details

Details for the file line-0.0.7.tar.gz.

File metadata

  • Download URL: line-0.0.7.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for line-0.0.7.tar.gz
Algorithm Hash digest
SHA256 5e65cff88015708339f0cc2d5261e0cd8d8dbe07c5c639151ecbe69c13025e46
MD5 a4dd75fadc11574a02989aec1fef8b0a
BLAKE2b-256 c5c749616ffe2233c2f7b9acdeefa3fda2a5bd6fcbe29087d028d0fd8ddf38bf

See more details on using hashes here.

Supported by

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