1. # -*- coding: utf-8 -*-
  2.  
  3. import requests
  4.  
  5. class HttpsClient:
  6.  
  7.     def __init__(self):
  8.         pass
  9.  
  10.     @staticmethod
  11.     def get(_url, _json):
  12.         _resp = requests.get(_url, _json)
  13.         return _resp.content
  14.  
  15.     @staticmethod
  16.     def https_post(_url, _json_dict):
  17.         _resp = requests.post(_url, _json_dict, verify=False)
  18.         return _resp.text
  19.  
  20.     @staticmethod
  21.     def https_post_with_header(_url, _json_dict, _headers):
  22.         _resp = requests.post(_url, data=_json_dict, headers=_headers, verify=False)
  23.         return _resp.text
  24.  
  25.  
  26. if __name__ == '__main__':
  27.     url = "http://192.168.1.2/test/hangup.php?x=111"
  28.     formate = {
  29.         "type":"AUTO",
  30.         "i":"i love python",
  31.         "doctype":"json",
  32.         "xmlVersion":"1.8",
  33.         "keyform":"fanyi.web",
  34.         "ue":"utf-8",
  35.         "action":"FY_BY_ENTER",
  36.         "typoResult":"true"
  37.     }
  38.     result = HttpsClient.https_post(url, formate)
  39.     print(result)