Posted in Python onFebruary 10, 2013
import urllib, httplib import utils import json class User: def __init__(self): print 'a' def login(self, imsi, ua): print "==============user start login==================" input = { "method" : "user.login", "userName" : "", "userPass" : "", } input["sig"] = utils.getSignature(input) params = urllib.urlencode(input) headers = { "user-agent" : ua, "Appstore-clientType" : "android", "Appstore-IMEI" : "123456789000000", "Appstore-IMSI" : imsi } try: connection = httplib.HTTPConnection(utils.API_HOST) connection.request("POST", "/api", params, headers) response = connection.getresponse().read() #print "=========" + response connection.close() except Exception, e : print "========" + str(e) if "errorcode" in response or response is None: return results = json.loads(response) return results["results"].encode("utf-8")
python client使用http post 到server端的代码
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@