George Keishing | e7e9171 | 2021-09-03 11:28:44 -0500 | [diff] [blame] | 1 | #!/usr/bin/env python3 |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 2 | import logging |
| 3 | import warnings |
Patrick Williams | 20f3871 | 2022-12-08 06:18:26 -0600 | [diff] [blame] | 4 | |
George Keishing | 3b7115a | 2018-08-02 10:48:17 -0500 | [diff] [blame] | 5 | try: |
| 6 | import httplib |
| 7 | except ImportError: |
| 8 | import http.client |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 9 | |
| 10 | warnings.filterwarnings("ignore") |
| 11 | |
| 12 | # Hijack the HTTP lib logger message and Log only once |
| 13 | requests_log = logging.getLogger("requests.packages.urllib3") |
| 14 | requests_log.setLevel(logging.CRITICAL) |
| 15 | requests_log.propagate = False |
| 16 | |
Gunnar Mills | 096cd56 | 2018-03-26 10:19:12 -0500 | [diff] [blame] | 17 | |
Patrick Williams | 20f3871 | 2022-12-08 06:18:26 -0600 | [diff] [blame] | 18 | class disable_warning_urllib: |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 19 | def do_nothing(): |
| 20 | return |