Christian Trujillo
Christian Trujillo

Reputation: 522

Google sheets API SSLEOFError (_ssl.c:2396)

SSLEOFError: EOF occurred in violation of protocol (_ssl.c:2396)

I get this error while trying to upload some web-scraped data to my google sheet, its not any more than Ive uploaded at once before, nor did I hit the end of the sheet. the data itself seems to be fine.

SCOPES = ['https://www.googleapis.com/auth/spreadsheets']


SERVICE_ACCOUNT_FILE = path+r'\keys.JSON'
creds= None
creds = service_account.Credentials.from_service_account_file(SERVICE_ACCOUNT_FILE, scopes = SCOPES)
service = build('sheets', 'v4', credentials=creds)
sheet = service.spreadsheets()
sheet.values().update(spreadsheetId=WKBKID, range=f'SheetName!A1', valueInputOption='USER_ENTERED', body={'values':[[data1],[data2],[data3],[etc]]}).execute()

if I start debugging before the last line runs and run it from the debug console it uploads like normal, but still gives the error when the program tries? help?

Upvotes: 1

Views: 916

Answers (1)

Alex
Alex

Reputation: 846

I believe I've ran into the same error recently. In my case, the issue was with the range actually: I specified something like A:F, while I should have specified A1:F50, as per my data.

Might be in this case API was also expecting a complete range, e.g. A1:Z10 instead of just the starting cell name.

An example can be found here in the documentation: https://developers.google.com/sheets/api/guides/values?hl=ru#python

Upvotes: 0

Related Questions