You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This page provides logging tips to help you debug your applications.
Log Level
You can enable logging of key events in this library by configuring Python's standard logging module. You can set the logging level to one of the following:
CRITICAL (least amount of logging)
ERROR
WARNING
INFO
DEBUG (most amount of logging)
In the following code, the logging level is set to INFO, and the Google Translate API is called:
The output of this code should print basic logging info:
INFO:root:URL being requested: https://www.googleapis.com/discovery/v1/apis/translate/v2/rest
INFO:root:URL being requested: https://www.googleapis.com/language/translate/v2?q=flower&q=car&source=en&alt=json&target=fr&key=your_api_key
{u'translations': [{u'translatedText': u'fleur'}, {u'translatedText': u'voiture'}]}
HTTP Traffic
For even more detailed logging you can set the debug level of the httplib2 module used by this library. The following code snippet enables logging of all HTTP request and response headers and bodies:
Activity
docs: Adds docs folder. Fixes googleapis#669 Fixes googleapis#670 Fixes
grant commentedon Jun 26, 2019
The docs are now added to the
docs/folder.Fixed with #706.