import requests, logging, time

def test():
    url = 'http://more-md.fanscloud.net/filebox.php?op=home'
    url_upload = 'https://more-me.fanscloud.net/typoraUpload'

    # logging.basicConfig()
    # logging.getLogger().setLevel(logging.DEBUG)
    # requests_log = logging.getLogger("requests.packages.urllib3")
    #
    # requests_log.setLevel(logging.DEBUG)
    #
    # requests_log.propagate = True




    ses = requests.session()


    req = ses.request(
        method='POST',
        url=url,
        params={"ip": '119.29.29.29'},
        data={"user": 'admin', "pass": '1234ABCDabcd', "submitButtonName": '登录'},
        headers={"Version": '1.0.0', "Connection": 'keep-alive'},
        cookies={},
        files={},
        auth=None,
        timeout=10,
        allow_redirects=False,
        proxies=None,
        verify=False,
        cert=None,
        json=None
    )
    req2 = ses.request(
        method='GET',
        url=url,
        params={"ip": '119.29.29.29'},
        data={},
        headers={"Version": '1.0.0', "Connection": 'keep-alive'},
        cookies={},
        files={},
        auth=None,
        timeout=10,
        allow_redirects=False,
        proxies=None,
        verify=False,
        cert=None,
        json=None
    )
    # req = requests.post(url=url, params={"ip": '119.29.29.29'}, proxies={"http": '127.0.0.1:8888', "https": '127.0.0.1:8888'})
    # proxies={"http": '127.0.0.1:8888', "https": '127.0.0.1:8888'},



    # print(req.request.method + ' ' + req.request.url + ' ' + 'HTTP/1.1' + '\r\n')
    print(req2.text)
    # print(req.headers)
    # logs = logging.getLogger()
    #
    # logs.setLevel(logging.DEBUG)
    #
    # path = './' + time.strftime('%Y-%m-%d-%H-%M-%S') + '.log'
    # write_file = logging.FileHandler(path, 'a+', encoding='utf-8')
    #
    # write_file.setLevel(logging.DEBUG)
    #
    # set_logs = logging.Formatter('%(asctime)s - %(filename)s - %(funcName)s - %(levelname)s - %(message)s')
    #
    # write_file.setFormatter(set_logs)
    #
    # pycharm_text = logging.StreamHandler()
    #
    # pycharm_text.setFormatter(set_logs)
    #
    # logs.addHandler(write_file)
    #
    # logs.addHandler(pycharm_text)
test()