0👍
✅
Python logging
package does not support filtering by the message content, only by message logger and message level.
Two potential ways to solve the problem are
-
Monkey-patch the violating function and replace it with your own version which doesn’t produce the given message (function at
requests.packages.urllib3.connectionpool
:171) -
Write your own logging handler which can handle filtering log messages by their content (very heavy handed approach just to get rid of one message)
Also as the long term solution you can try
- Communicate the
requests
package community, explain your issue, seek co-operation and write the patch to fix the library, so that in the future versions one can get rid of the particular message easily
Source:stackexchange.com