Skip to content

Instantly share code, notes, and snippets.

@ibotdotout
Forked from windows98SE/api.py.patch
Last active August 29, 2015 14:25
Show Gist options
  • Save ibotdotout/b9c99e888f21649ad0b4 to your computer and use it in GitHub Desktop.
Save ibotdotout/b9c99e888f21649ad0b4 to your computer and use it in GitHub Desktop.
@@ -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 = '[email protected]'
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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment