复制代 代码如下:
import urllib, httplib
import utils
import json
class User:
def __init__(self):
print 'a'
def login(self, imsi, ua):
print "=========== ===ユーザーのログイン開始=================="
input = {
"method" : "user.login",
"userName" : "",
"userPass" : "",
}
input["sig"] = utils.getSignature(input)
params = urllib.urlencode(input)
headers = {
"user-agent" : ua,
"Appstore-clientType" : "android",
"Appstore-IMEI" : "12345 6789000000",
"Appstore-IMSI" : imsi
}
try:
connection = httplib.HTTPConnection(utils.API_HOST)
connection.request("POST", 、パラメータ、ヘッダー)
レスポンス= connection.getresponse().read()
#print "========= = + response
connection.close()
例外、e :
印刷 "= ======= = + str(e)
レスポンスまたはレスポンスの「errorcode」が None の場合:
return
results = json.loads(response)
return results["results"].encode("utf-8")