Skip to content

Instantly share code, notes, and snippets.

@windows98SE
Created May 23, 2015 15:18
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 12 You must be signed in to fork a gist
  • Save windows98SE/b739038218b6fe4d423f to your computer and use it in GitHub Desktop.
Save windows98SE/b739038218b6fe4d423f to your computer and use it in GitHub Desktop.
[fix] LINE API function login ( api.py ) / new examples
@@ -55,7 +55,21 @@
After login, make `client` and `client_in` instance
to communicate with LINE server
"""
- raise Exception("Code is removed because of the request of LINE corporation")
+
+ self.transport = THttpClient.THttpClient(self.LINE_HTTP_URL)
+ self.transport_in = THttpClient.THttpClient(self.LINE_HTTP_IN_URL)
+
+ self.transport.setCustomHeaders(self._headers)
+ self.transport_in.setCustomHeaders(self._headers)
+
+ self.protocol = TCompactProtocol.TCompactProtocol(self.transport)
+ self.protocol_in = TCompactProtocol.TCompactProtocol(self.transport_in)
+
+ self._client = CurveThrift.Client(self.protocol)
+ self._client_in = CurveThrift.Client(self.protocol_in)
+
+ self.transport.open()
+ self.transport_in.open()
def updateAuthToken(self):
"""
from line import LineClient, LineGroup, LineContact
USERNAME = 'admin@stephack.com'
PASSWORD = ''
GROUPNAME = 'SecGozzip'
MSG = 'hello world!'
#optional
COMPUTERNEME = 'StepHack.Line.Bot.v1'
TOKEN = ''
try:
client = LineClient(id=USERNAME, password=PASSWORD, authToken=TOKEN, com_name=COMPUTERNEME)
TOKEN = client.authToken
print "TOKEN : %s\r\n" % TOKEN
client_group = client.getGroupByName(GROUPNAME)
recent_group_msg = client_group.getRecentMessages(count=10)
print "RecentMessages : %s\r\n" % recent_group_msg
client_group.sendMessage(MSG)
except:
print "Login Failed"
@Wingless-Archangel
Copy link

COMPUTERNAME?

@parkong
Copy link

parkong commented Nov 15, 2016

tttt

@Colonel-Top
Copy link

I think it's not working ... with recent_group_msg not detect :(

@anoaghost
Copy link

still not working, how solved ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment