nithinmurali / pygsheets

Google Sheets Python API v4

Home Page:https://pygsheets.readthedocs.io/en/latest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Stopped working since 3 days

ashwarsadh opened this issue · comments

Pygsheets stopped working since 3 days.
when using .open() or .open_by_key() started getting error OSError: [Errno 101] Network is unreachable

All other setup and settings remained unchanged, just stopped working suddenly

Error Traceback as below:

Traceback (most recent call last):
File "/usr/lib/cgi-bin/po.py", line 32, in
gc.open("POFormat")
File "/usr/lib/python3.8/site-packages/pygsheets/client.py", line 143, in open
spreadsheet = list(filter(lambda x: x['name'] == title, self.drive.spreadsheet_metadata()))[0]
File "/usr/lib/python3.8/site-packages/pygsheets/drive.py", line 144, in spreadsheet_metadata
return self._metadata_for_mime_type(self._spreadsheet_mime_type, query, only_team_drive)
File "/usr/lib/python3.8/site-packages/pygsheets/drive.py", line 169, in _metadata_for_mime_type
return self.list(fields=FIELDS_TO_INCLUDE,
File "/usr/lib/python3.8/site-packages/pygsheets/drive.py", line 87, in list
response = self._execute_request(self.service.files().list(**kwargs))
File "/usr/lib/python3.8/site-packages/pygsheets/drive.py", line 427, in _execute_request
return request.execute(num_retries=self.retries)
File "/usr/lib/python3.8/site-packages/googleapiclient/_helpers.py", line 131, in positional_wrapper
return wrapped(*args, **kwargs)
File "/usr/lib/python3.8/site-packages/googleapiclient/http.py", line 922, in execute
resp, content = _retry_request(
File "/usr/lib/python3.8/site-packages/googleapiclient/http.py", line 190, in _retry_request
resp, content = http.request(uri, method, *args, **kwargs)
File "/usr/lib/python3.8/site-packages/google_auth_httplib2.py", line 209, in request
self.credentials.before_request(self._request, method, uri, request_headers)
File "/usr/lib/python3.8/site-packages/google/auth/credentials.py", line 133, in before_request
self.refresh(request)
File "/usr/lib/python3.8/site-packages/google/oauth2/service_account.py", line 410, in refresh
access_token, expiry, _ = _client.jwt_grant(
File "/usr/lib/python3.8/site-packages/google/oauth2/_client.py", line 193, in jwt_grant
response_data = _token_endpoint_request(request, token_uri, body)
File "/usr/lib/python3.8/site-packages/google/oauth2/_client.py", line 161, in _token_endpoint_request
response_status_ok, response_data = _token_endpoint_request_no_throw(
File "/usr/lib/python3.8/site-packages/google/oauth2/_client.py", line 115, in _token_endpoint_request_no_throw
response = request(method="POST", url=token_uri, headers=headers, body=body)
File "/usr/lib/python3.8/site-packages/google_auth_httplib2.py", line 119, in call
response, data = self.http.request(
File "/usr/lib/python3.8/site-packages/httplib2/init.py", line 1701, in request
(response, content) = self._request(
File "/usr/lib/python3.8/site-packages/httplib2/init.py", line 1421, in _request
(response, content) = self._conn_request(conn, request_uri, method, body, headers)
File "/usr/lib/python3.8/site-packages/httplib2/init.py", line 1343, in _conn_request
conn.connect()
File "/usr/lib/python3.8/site-packages/httplib2/init.py", line 1179, in connect
raise socket_err
File "/usr/lib/python3.8/site-packages/httplib2/init.py", line 1133, in connect
sock.connect((self.host, self.port))
OSError: [Errno 101] Network is unreachable

Can anyone confirm getting same error or assist in same?

Getting SSL Errors while authenticating:

File "/usr/lib/python3.8/ssl.py", line 1309, in do_handshake
self._sslobj.do_handshake()
OSError: [Errno 0] Error

Maybe google made some changes?
I tried updating python, pygsheets, google oauth modules, but couldnt resolve

Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "/usr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 386, in _make_request
self._validate_conn(conn)
File "/usr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 1040, in validate_conn
conn.connect()
File "/usr/lib/python3.8/site-packages/urllib3/connection.py", line 416, in connect
self.sock = ssl_wrap_socket(
File "/usr/lib/python3.8/site-packages/urllib3/util/ssl
.py", line 449, in ssl_wrap_socket
ssl_sock = ssl_wrap_socket_impl(
File "/usr/lib/python3.8/site-packages/urllib3/util/ssl
.py", line 493, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
File "/usr/lib/python3.8/ssl.py", line 500, in wrap_socket
return self.sslsocket_class._create(
File "/usr/lib/python3.8/ssl.py", line 1040, in _create
self.do_handshake()
File "/usr/lib/python3.8/ssl.py", line 1309, in do_handshake
self._sslobj.do_handshake()
OSError: [Errno 0] Error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/requests/adapters.py", line 440, in send
resp = conn.urlopen(
File "/usr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 785, in urlopen
retries = retries.increment(
File "/usr/lib/python3.8/site-packages/urllib3/util/retry.py", line 550, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/usr/lib/python3.8/site-packages/urllib3/packages/six.py", line 769, in reraise
raise value.with_traceback(tb)
File "/usr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "/usr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 386, in _make_request
self._validate_conn(conn)
File "/usr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 1040, in validate_conn
conn.connect()
File "/usr/lib/python3.8/site-packages/urllib3/connection.py", line 416, in connect
self.sock = ssl_wrap_socket(
File "/usr/lib/python3.8/site-packages/urllib3/util/ssl
.py", line 449, in ssl_wrap_socket
ssl_sock = ssl_wrap_socket_impl(
File "/usr/lib/python3.8/site-packages/urllib3/util/ssl
.py", line 493, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
File "/usr/lib/python3.8/ssl.py", line 500, in wrap_socket
return self.sslsocket_class._create(
File "/usr/lib/python3.8/ssl.py", line 1040, in _create
self.do_handshake()
File "/usr/lib/python3.8/ssl.py", line 1309, in do_handshake
self._sslobj.do_handshake()
urllib3.exceptions.ProtocolError: ('Connection aborted.', OSError(0, 'Error'))

Hi @ashwarsadh , I tried to replicate this. But was unable to do so. Pygsheets auth and access works fine for me.

To troubleshoot can you please run the following code from the google API website? link (ofcourse change the sheet_id and tocken path in the sample given)

closing, as there is no response. Please reopen if you are still facing the issue.