首页 博客 娱乐 图库 新闻 体育 视频

Python2.7 HTTPS POST请求

# -*- coding: utf-8 -*- import requests class HttpsClient: def __init__(self): pass @staticmethod def get(_url, _json): _resp = requests.get(_url, _json) return _resp.content @staticmethod def https_post(_url, _json_dict): _resp = requests.post(_url, _json_dict, verify=False) return _resp.text @staticmethod def https_post_with_header(_url, _json_dict, _headers): _resp = requests.post(_url, data=_json_dict, headers=_headers, verify=False) return _resp.text if __name__ == '__main__': url = "http://knowledge.daletripp.com/test/hangup.php?x=111" formate = { "type":"AUTO", "i":"i love python", "doctype":"json", "xmlVersion":"1.8", "keyform":"fanyi.web", "ue":"utf-8", "action":"FY_BY_ENTER", "typoResult":"true" } result = HttpsClient.https_post(url, formate) print(result)


除非特别注明,本站所有文字均为原创文章,作者:luojie

No Comment

留言

电子邮件地址不会被公开。 必填项已用*标注

感谢你的留言。。。