filtering out warnings

Jason Friedman jsf80238 at gmail.com
Sun Nov 29 16:32:24 EST 2020


>
> The Box API is noisy ... very helpful for diagnosing, and yet for
> production code I'd like less noise.
>
> I tried this:
>
> warnings.filterwarnings(
>     action='ignore',
>     # category=Warning,
>     # module=r'boxsdk.*'
> )
>
> but I still see this:
>
> WARNING:boxsdk.network.default_network:"POST
> https://api.box.com/oauth2/token" 400 83
> {'Date': 'Sat, 28 Nov 2020 04:30:03 GMT', 'Content-Type':
> 'application/json', 'Transfer-Encoding': 'chunked', 'Connection':
> 'keep-alive', 'Strict-Transport-Security': 'max-age=31536000',
> 'Set-Cookie': 'box_visitor_id=5fc1d24b134ce6.76522820; expires=Sun,
> 28-Nov-2021 04:30:03 GMT;
>

Posted and answered on StackOverflow (
https://stackoverflow.com/questions/65061846/filtering-out-warnings-from-box-sdk-python/
).

Answer was:
import logging
logging.getLogger('boxsdk').setLevel(logging.CRITICAL)


More information about the Python-list mailing list