LINE manual

Introduction

line is a python library that allow you to send and receive a LINE message. With line you can use LINE on any systems like Ubuntu or make your own LINE bot which will automatically reply for your message!

Enjoy line and May the LINE be with you...

Warning

Some codes are removed because of the request of LINE corporation. (2014.08.08)

Key Features

  • login to LINE server
  • get a list of contact, group or chat room
  • send and receive a message or sticker
  • invite, join or leave a group or room
  • longPoll method which will allow you to make a LINE bot easily

Todo

  • Sending a Image
  • More usable methods and objects

Installation

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

Indices and tables

Echo bot example

from line import LineClient, LineGroup, LineContact

try:
   client = LineClient("ID", "PASSWORD")
   #client = LineClient(authToken="AUTHTOKEN")
except:
   print "Login Failed"

while True:
   op_list = []

   for op in client.longPoll():
      op_list.append(op)

   for op in op_list:
      sender   = op[0]
      receiver = op[1]
      message  = op[2]

      msg = message.text
      receiver.sendMessage("[%s] %s" % (sender.name, msg))

License

Source codes are distributed under BSD license.

Author

Taehoon Kim / @carpedm20