# -*- 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 = "https://www.baidu.com"
    json_dict = '{}'
    result = HttpsClient.https_post(url, json_dict)
    print(result)

  代码依赖requests,可通过下述命令安装:

python -m pip  --trusted-host pypi.python.org install -i https://pypi.tuna.tsinghua.edu.cn/simple requests

相关文章:

  • 2021-06-19
  • 2022-12-23
  • 2021-10-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-29
  • 2021-12-23
  • 2022-12-23
相关资源
相似解决方案