HTTP errors - intermittent
See original GitHub issueI’m getting intermittent HTTP errors when reading or (more frequently) writing to sheets. I moved to Gspread from GoogleCL, and I’ve been happy with ease and speed, but now I’m getting more of these errors. It works most of the time, but not consistently. Thanks in advance!
My code for writing is (essentially) here:
def SaveHistory(History, reassesslist, todaydict, date,did):
username = '...'
password = '...'
sheetname = "Re"
client = gspread.login(username, password)
spreadsheet = client.open(sheetname)
worksheet = spreadsheet.sheet1
worksheet.resize(rows=1,cols=12)
for row in reassesslist:
worksheet.append_row(temp)
The error (or at least the most recent one that I’ve gotten): Exception in Tkinter callback Traceback (most recent call last): File “/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gspread/client.py”, line 137, in open feed = self.get_spreadsheets_feed() File “/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gspread/client.py”, line 223, in get_spreadsheets_feed r = self.session.get(url) File “/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gspread/httpsession.py”, line 79, in get return self.request(‘GET’, url, **kwargs) File “/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gspread/httpsession.py”, line 75, in request raise HTTPError(response) HTTPError
Issue Analytics
- State:
- Created 9 years ago
- Comments:32 (11 by maintainers)
Top GitHub Comments
Yeah, this part of the ref needs more details.
You need to go to Google Developers Console. Create a new project (or select the one you have.)
Under “API & auth”, in the API enable “Drive API”.
Go to “Credentials” and hit “Create new Client ID”.
Select “Service account”. Hitting “Create Client ID” will generate a new Public/Private key pair. You will automatically download a JSON file with this data.
This is how this file looks like:
You need
client_email
andprivate_key
(yes, that’s aSIGNED_KEY
)Now you can read this file, and use the data when constructing your credentials:
Don’t forget to share your spreadsheet with an email you have in your
json_key['client_email']
.Good, I’m glad it helped you.