Re: filtering out warnings

2020-11-29 Thread Jason Friedman
>
> 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)
-- 
https://mail.python.org/mailman/listinfo/python-list


filtering out warnings

2020-11-27 Thread Jason Friedman
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.
-- 
https://mail.python.org/mailman/listinfo/python-list