I'm following this guide https://developers.google.com/sheets/api/quickstart/python
Upon running the sample code they provided (The only thing I changed was the location of the api secret since we already had one set up and the APPLICATION_NAME) I get this error
AttributeError: 'module' object has no attribute 'DEFAULT_MAX_REDIRECTS'
Log before the error
File "generate_report.py", line 2, in <module>
import httplib2
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/httplib2/__init__.py", line 42, in <module>
import calendar
File "/Users/HarshaGoli/Git/PantherBot/scripts/calendar.py", line 1, in <module>
from oauth2client.service_account import ServiceAccountCredentials
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/oauth2client/service_account.py", line 25, in <module>
from oauth2client import client
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/oauth2client/client.py", line 39, in <module>
from oauth2client import transport
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/oauth2client/transport.py", line 255, in <module>
redirections=httplib2.DEFAULT_MAX_REDIRECTS,
I got the same error and investigated on the problem.
In my case, it was caused by a file named ''calendar.py" in the same directory.
It's said you should avoid using general names that can be used for standard python library.
It may be versioning problem. It could be python3 version of httplib2 which cause troubles, try to follow answer from this post
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With