0 votes
1 view
in Python by (47.8k points)

By default, the Requests Python library writes log messages to the console, along the lines of:

Starting new HTTP connection (1): example.com http://example.com:80 "GET / HTTP/1.1" 200 606

I'm usually not interested in these messages and would like to disable them. What would be the best way to silence those messages or decrease Requests' verbosity?

1 Answer

0 votes
by (107k points)

If you want to disable log messages from the Requests library then you can configure requests' logging level, and this is done via the standard logging module. Below-is the code for the same:-

import logging

logging.getLogger("requests").setLevel(logging.WARNING)

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...