国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

python client使用http post 到server端的代碼

2020-02-23 04:50:37
字體:
來源:轉載
供稿:網友
代碼如下:
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)     
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 黔东| 思茅市| 青岛市| 布尔津县| 凤阳县| 黄梅县| 阆中市| 鹤峰县| 岱山县| 澄城县| 颍上县| 永仁县| 财经| 通城县| 陆河县| 沾益县| 岳池县| 怀远县| 明光市| 定远县| 黔东| 郸城县| 张家口市| 五常市| 乐安县| 静海县| 上思县| 专栏| 宁城县| 鹿邑县| 永修县| 临海市| 海盐县| 聊城市| 肇庆市| 深圳市| 和平县| 普格县| 富川| 海宁市| 措勤县|