skip to navigation
skip to content

line 0.1.0

May the LINE be with you...

Latest Version: 0.8.2

|PyPi version| |PyPi downloads|

  • 2014.08.06 UPDATE : Echo bot example update!!!
  • 2014.08.06 UPDATE : We can send a sticker!!!
  • 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("", "xxxxxxxxxx")
Enter PinCode '7390' to your mobile phone in 2 minutes
>>> print client.profile


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


$ pip install line

Or, you can use:

$ easy_install line

Or, you can also install manually:

$ git clone git://
$ cd LINE
$ python install


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

If there is a change in contact or group, you’d better call:

>>> client.refreshGroup()
>>> client.refreshContact()

You can get contact and group from name by:

>>> contact = client.getContactFromName('CONTACT_NAME')
>>> group = client.getGroupFromName('GROUP_NAME')

Send a message

You can send a message by:

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

You can send a sticker by:

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

Get a list of 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=15)

Create a chat room or group

>>> members = [client.contacts[0], client.contacts[1]]
>>> room = client.createRoomWithContacts(members)
>>> group = client.createGroupWithContacts(name="Test group", contacts=members)

Leave a chat room or group

>>> room.leave()
>>> group.leave()



  • Send a Image file
  • More usable methods and objects


Source codes are distributed under BSD license.


Taehoon Kim / @carpedm20

File Type Py Version Uploaded on Size
line-0.1.0.tar.gz (md5) Source 2014-08-07 11KB