# -*- 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://192.168.1.2/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)
发表评论