botbotbot 's blog

Python Line API

Line API requirement - Line API Documentation

Install Thrift on Ubuntu

$ apt-get install -y automake libtool flex bison pkg-config g++ libssl-dev make libqt4-dev git debhelper cmake
$ cd /tmp
$ curl http://archive.apache.org/dist/thrift/0.9.1/thrift-0.9.1.tar.gz | tar zx
$ cd /tmp/thrift-0.9.1
$ ./configure
$ make && make install
$ rm -rf /tmp/thrift-0.9.1

Fix login with email and password failed

# installl line and remove first that tricky don't know why
$ pip install line && pip uninstall -y line
$ git clone https://github.com/carpedm20/LINE.git
$ cd LINE/line
$ wget https://gist.github.com/windows98SE/b739038218b6fe4d423f/raw/5f68cf3d9a2a88576b739810a6bd6fcaa0c5e940/api.py.patch
$ patch api.py < api.py.patch
$ python config.py
$ python setup.py install

Sample Bot

Line API Patched Dockerfile on Ubuntu

Line send message by LineID

References:

  1. Python Line API Repository
  2. Line API Documentation
  3. StepHack.Com : มาเขียน บอท line ด้วย Python กันเถอะ
  4. How to use LINE API in python ( lt’s work)
  5. Line reverse engineering