filtering out warnings

Jason Friedman jsf80238 at gmail.com
Fri Nov 27 23:32:17 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; Max-Age=31536000; path=/; domain=.box.com;
secure, bv=OPS-44131; expires=Sat, 05-Dec-2020 04:30:03 GMT;
Max-Age=604800; path=/; domain=.app.box.com; secure, cn=87; expires=Sun,
28-Nov-2021 04:30:03 GMT; Max-Age=31536000; path=/; domain=.app.box.com;
secure, site_preference=desktop; path=/; domain=.box.com; secure',
'Cache-Control': 'no-store'}
{'error': 'invalid_client',
 'error_description': 'The client credentials are invalid'}

My code as written I think should filter ALL warnings. I'll eventually want
to restrict the filter to only warnings generated by the Box SDK.


More information about the Python-list mailing list