Created
May 23, 2015 15:18
-
-
Save windows98SE/b739038218b6fe4d423f to your computer and use it in GitHub Desktop.
[fix] LINE API function login ( api.py ) / new examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -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): | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
tttt
I think it's not working ... with recent_group_msg not detect :(
still not working, how solved ?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
COMPUTERNAME?