我将
google-cloud-bigquery
从版本 3.11.4
更新为 3.12.0
。
requests 和 urllib3 已绑定。
requests==2.31.0
requests-futures==1.0.1
requests_pkcs12==1.21
urllib3==1.26.18
有时我会收到此错误,但不明白为什么:
File "/usr/local/lib/python3.10/site-packages/google/api_core/future/polling.py", line 282, in exception
self._blocking_poll(timeout=timeout)
File "/usr/local/lib/python3.10/site-packages/google/cloud/bigquery/job/query.py", line 1318, in _blocking_poll
super(QueryJob, self)._blocking_poll(timeout=timeout, **kwargs)
File "/usr/local/lib/python3.10/site-packages/google/api_core/future/polling.py", line 137, in _blocking_poll
polling(self._done_or_raise)(retry=retry)
File "/usr/local/lib/python3.10/site-packages/google/api_core/retry.py", line 366, in retry_wrapped_func
return retry_target(
File "/usr/local/lib/python3.10/site-packages/google/api_core/retry.py", line 204, in retry_target
return target()
File "/usr/local/lib/python3.10/site-packages/google/cloud/bigquery/job/query.py", line 1460, in _done_or_raise
self.reload(retry=retry, timeout=transport_timeout)
File "/usr/local/lib/python3.10/site-packages/google/cloud/bigquery/job/base.py", line 781, in reload
api_response = client._call_api(
File "/usr/local/lib/python3.10/site-packages/google/cloud/bigquery/client.py", line 816, in _call_api
return call()
File "/usr/local/lib/python3.10/site-packages/google/cloud/_http/__init__.py", line 482, in api_request
response = self._make_request(
File "/usr/local/lib/python3.10/site-packages/google/cloud/_http/__init__.py", line 341, in _make_request
return self._do_request(
File "/usr/local/lib/python3.10/site-packages/google/cloud/_http/__init__.py", line 379, in _do_request
return self.http.request(
File "/usr/local/lib/python3.10/site-packages/google/auth/transport/requests.py", line 542, in request
response = super(AuthorizedSession, self).request(
File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 483, in send
timeout = TimeoutSauce(connect=timeout, read=timeout)
File "/usr/local/lib/python3.10/site-packages/urllib3/util/timeout.py", line 102, in __init__
self._connect = self._validate_timeout(connect, "connect")
File "/usr/local/lib/python3.10/site-packages/urllib3/util/timeout.py", line 147, in _validate_timeout
raise ValueError(
ValueError: Timeout value connect was <object object at 0x7c6b5e484a80>, but it must be an int, float or None.
我在其他问题上看到这是因为我需要将 urllib3 降级到小于 2 的版本,但这已经是我的情况了。
该错误表明正在传递无效的超时值。确保您的请求中的超时参数设置正确。例如:
import requests
response = requests.get('https://example.com', timeout=(5, 27))
检查代码或依赖项的任何部分是否不正确地修改了超时值。