HTTP requests debug in python
# These two lines enable debugging at httplib level (requests->urllib3->http.client)# You will see the REQUEST, including HEADERS and DATA, and RESPONSE with HEADERS but without DATA.# The only thing missing will be the response.body which is not logged.try: import http.client as http_clientexcept ImportError: # Python 2 import httplib as http_clienthttp_client.HTTPConnection.debuglevel = 1
# You must initialize logging, otherwise you'll not see debug output.logging.basicConfig()logging.getLogger().setLevel(logging.DEBUG)
Cap comentari:
Publica un comentari a l'entrada
Escriu