示例#1
0
 def CheckIsLogin91(self, uid, session):
     XMHttpClient.set_pro_url(self, xiaomi_conf.Session_URL_91)
     params = {}
     params['AppId'] = self.clientId
     params['Act'] = 4  # 登录的act编号
     params['Uin'] = uid
     params['SessionId'] = session
     params['Sign'] = self.xmUtils.buildSignature_91(params, self.clientSecret)
     return self.getErrCode(params)
示例#2
0
 def CheckIsLoginPP(self, sid):
     XMHttpClient.set_pro_url(self, xiaomi_conf.Session_URL_PP)
     params = {}
     params['id'] = int(time.time())
     params['service'] = "account.verifySession"
     params['data'] = {'sid': sid}
     params['game'] = {'gameId': int(self.clientId)}
     params['encrypt'] = "md5"
     params['sign'] = self.xmUtils.buildSignature_PP(sid, self.clientSecret)
     print "params::", params
     return self.postErrCode(params)
 def __init__(self, clientId, accessToken):
     XMHttpClient.__init__(self, xiaomi_conf.API_URL)
     self.clientId = clientId
     self.accessToken = accessToken
     self.xmUtils = XMUtils()
     self.host = urlparse(xiaomi_conf.API_URL).hostname
示例#4
0
 def getErrCode(self, params):
     res = XMHttpClient.get(self, '', params)
     data = res.read()
     jsonObject = XMHttpClient.safeJsonLoad(self, data)
     return jsonObject
示例#5
0
 def getAccessToken(self, params):
     res = XMHttpClient.get(self, self.OAUTH2_PATH['token'], params)
     jsonObject = XMHttpClient.safeJsonLoad(self, res.read())
     return jsonObject
示例#6
0
 def __init__(self, clientId, clientSecret, redirectUri):
     XMHttpClient.__init__(self, xiaomi_conf.VerifySession_URL)
     self.clientId = clientId
     self.clientSecret = clientSecret
     self.redirectUri = redirectUri
     self.xmUtils = XMUtils()
示例#7
0
 def postErrCode(self, params):
     res = XMHttpClient.post(self, '', params,  header={'content-type':'text/plain'})
     jsonObject = XMHttpClient.safeJsonLoad(self, res.read(),)
     return jsonObject
示例#8
0
 def CheckIsLoginAS(self, token):
     XMHttpClient.set_pro_url(self, xiaomi_conf.Session_URL_AS)
     params = {}
     params['token'] = token
     return self.getErrCode(params)
示例#9
0
 def CheckIsLoginTB(self, session):
     XMHttpClient.set_pro_url(self, xiaomi_conf.Session_URL_TB)
     params = {}
     params['k'] = session
     return self.getTBCode(params)
示例#10
0
 def getTBCode(self, params):
     res = XMHttpClient.get(self, '', params)
     data = res.read()
     return data
示例#11
0
 def __init__(self, clientId, accessToken):
     XMHttpClient.__init__(self, xiaomi_conf.API_URL)
     self.clientId = clientId
     self.accessToken = accessToken
     self.xmUtils = XMUtils()
     self.host = urlparse(xiaomi_conf.API_URL).hostname
示例#12
0
 def __init__(self, clientId, clientSecret, redirectUri):
     XMHttpClient.__init__(self, xiaomi_conf.OAUTH2_URL)
     self.clientId = clientId
     self.clientSecret = clientSecret
     self.redirectUri = redirectUri