PROJET AUTOBLOG


shaarli-Links

Site original : shaarli-Links

⇐ retour index

Note: [python] debug urllib3 requests post

mercredi 14 juin 2023 à 11:30
import requests
import urllib3

import logging
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
requests_log = logging.getLogger("requests.packages.urllib3")
requests_log.setLevel(logging.DEBUG)
requests_log.propagate = True
import http.client as http_client
http_client.HTTPConnection.debuglevel = 1

urllib3.disable_warnings()
r = requests.Session()
r.verify = False

headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0",
    "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
    "Accept-Language": "fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3",
    "Accept-Encoding": "gzip, deflate, br",
    "Connection": "keep-alive",
    'Content-Type':'application/x-www-form-urlencoded'
}

proxy_servers = {
    'http': 'http://192.168.1.123:3131',
    'https': 'http://192.168.1.123:3131',
}

page = r.post(url, headers=headers, verify=False, allow_redirects=False, proxies=proxy_servers, data={'msg':'hello world'} )

Permalink