pykakao is a simple kakaotalk LOCO/HTTP API protocol wrapper for python.
Install it using setup.py.
python setup.py install
If you are using Windows, you need to install PyCrypto manually.
To install PyCrypto manually, follow these steps.
- Download zip archive.
- Unzip it in Python's
site-packagesdirectory(Ex.C:\Python27\Lib\site-packagesor/Library/Python/2.7).
- How to get session key and user id
from pykakao import kakaotalk
kakao = kakaotalk()
if kakao.auth("EMAIL", "PASSWORD", "COMPUTER NAME", "DEVICE ID"):
# computer name and device id are not important things. you can pass any string you want.
print kakao.session_key
print kakao.user_id
else:
print "auth failed."- A Simple echoing bot
from pykakao import kakaotalk
kakao = kakaotalk("SESSION KEY", "DEVICE ID", USER ID)
if kakao.login():
while True:
packet = kakao.translate_response()
if not packet:
print "connection closed."
if packet["command"] == "MSG":
if packet["body"]["chatLog"]["authorId"] != kakao.user_id:
kakao.write(packet["body"]["chatLog"]["chatId"], packet["body"]["chatLog"]["message"])
else:
print "login failed."pykakao is following MIT License.
Cai(0x90 :: Cai's Blog)