gpt4 book ai didi

python - RemoteDisconnected ("Remote end closed connection without"http.client.RemoteDisconnected : Remote end closed connection without response

转载 作者:太空宇宙 更新时间:2023-11-04 04:26:38 28 4
gpt4 key购买 nike

由于 Google 拒绝除了已建立的公司之外的所有公司访问 Google MyBusiness 的 API key ,我尝试使用 selenium webdriver 自动执行更改我的业务信息的过程。

什么有效?

通过自动登录表单登录 Google Mybusiness。

什么不起作用?

登录后,我需要打开编辑工作时间的小模态。我试图自动点击编辑按钮,但不幸的是我收到了这个错误:http.client.RemoteDisconnected: Remote end closed connection without response

我的代码:

from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument("start-maximized")
driver = webdriver.Chrome(chrome_options=options)

def LoginGMB(driver):
(myemail, mypassword) = AuthenticationDetails()
driver.find_element_by_id('identifierId').send_keys(myemail)
driver.find_element_by_id('identifierNext').click()
time.sleep(2)
driver.find_element_by_name('password').send_keys(mypassword)
driver.find_element_by_id('passwordNext').click()
time.sleep(2)

def OpenGMB(url):
driver.get(url)
print(driver.current_url)
pattern = re.compile(".*accounts.google.com/signin.*")
match = re.search(pattern, cururl)
if match:
LoginGMB(driver)
print("Ok we're back")
driver.find_element_by_id('ow50').click()

OpenGMB('https://business.google.com/edit/l/001?hl=en')

堆栈跟踪:

https://accounts.google.com/signin/v2/identifier?service=lbc&passive=1209600&continue
We need to login as we are presented login page
Ok we're back
Traceback (most recent call last):
File "/home/joel/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/home/joel/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 384, in _make_request
six.raise_from(e, None)
File "<string>", line 2, in raise_from
File "/home/joel/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 380, in _make_request
httplib_response = conn.getresponse()
File "/usr/lib/python3.6/http/client.py", line 1331, in getresponse
response.begin()
File "/usr/lib/python3.6/http/client.py", line 297, in begin
version, status, reason = self._read_status()
File "/usr/lib/python3.6/http/client.py", line 266, in _read_status
raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "gmb.py", line 77, in <module>
OpenGMB(url)
File "gmb.py", line 62, in OpenGMB
el = driver.find_element_by_id('ow50')
File "/home/joel/.local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 360, in find_element_by_id
return self.find_element(by=By.ID, value=id_)
File "/home/joel/.local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 978, in find_element
'value': value})['value']
File "/home/joel/.local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 319, in execute
response = self.command_executor.execute(driver_command, params)
File "/home/joel/.local/lib/python3.6/site-packages/selenium/webdriver/remote/remote_connection.py", line 376, in execute
return self._request(command_info[0], url, body=data)
File "/home/joel/.local/lib/python3.6/site-packages/selenium/webdriver/remote/remote_connection.py", line 399, in _request
resp = self._conn.request(method, url, body=body, headers=headers)
File "/home/joel/.local/lib/python3.6/site-packages/urllib3/request.py", line 72, in request
**urlopen_kw)
File "/home/joel/.local/lib/python3.6/site-packages/urllib3/request.py", line 150, in request_encode_body
return self.urlopen(method, url, **extra_kw)
File "/home/joel/.local/lib/python3.6/site-packages/urllib3/poolmanager.py", line 323, in urlopen
response = conn.urlopen(method, u.request_uri, **kw)
File "/home/joel/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "/home/joel/.local/lib/python3.6/site-packages/urllib3/util/retry.py", line 367, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/home/joel/.local/lib/python3.6/site-packages/urllib3/packages/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/home/joel/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/home/joel/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 384, in _make_request
six.raise_from(e, None)
File "<string>", line 2, in raise_from
File "/home/joel/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 380, in _make_request
httplib_response = conn.getresponse()
File "/usr/lib/python3.6/http/client.py", line 1331, in getresponse
response.begin()
File "/usr/lib/python3.6/http/client.py", line 297, in begin
version, status, reason = self._read_status()
File "/usr/lib/python3.6/http/client.py", line 266, in _read_status
raise RemoteDisconnected("Remote end closed connection without"
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))

最佳答案

这些错误信息...

    RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

    RemoteDisconnected("Remote end closed connection without"
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))

...表示 远程连接 由于 ProtocolError 而断开。

根据 urllib3.exceptions.ProtocolError: ('Connection aborted.', error(10054, 'An existing connection was forcibly closed by the remote host'))当您使用的二进制文件版本之间存在不兼容时,此问题非常明显。

当您使用 ChromeDriverChrome 浏览器 时,您必须确保二进制文件符合以下条目:

  • ChromeDriver v2.46:支持 Chrome v71-73
  • ChromeDriver v2.45:支持 Chrome v70-72
  • ChromeDriver v2.44:支持 Chrome v69-71(与 ChromeDriver 2.43 相同,但修复了其他错误)
  • ChromeDriver v2.43:支持 Chrome v69-71
  • ChromeDriver v2.42:支持 Chrome v68-70
  • ChromeDriver v2.41:支持 Chrome v67-69
  • ChromeDriver v2.40:支持 Chrome v66-68
  • ChromeDriver v2.39:支持 Chrome v66-68
  • ChromeDriver v2.38:支持 Chrome v65-67
  • ChromeDriver v2.37:支持 Chrome v64-66
  • ChromeDriver v2.36:支持 Chrome v63-65
  • ChromeDriver v2.35:支持 Chrome v62-64
  • ChromeDriver v2.34:支持 Chrome v61-63
  • ChromeDriver v2.33:支持 Chrome v60-62
  • ChromeDriver v2.32:支持 Chrome v59-61
  • ChromeDriver v2.31:支持 Chrome v58-60
  • ChromeDriver v2.30:支持 Chrome v58-60
  • ChromeDriver v2.29:支持 Chrome v56-58
  • ChromeDriver v2.28:支持 Chrome v55-57
  • ChromeDriver v2.27:支持 Chrome v54-56

Note: A few months ago, Chromium Team made a preliminary announcement that ChromeDriver's versioning model will be changing. Now we are moving forward with the plan. Specifically, ChromeDriver 2.46 will be the last release carrying the major version of 2. Future ChromeDriver releases will carry a version number similar to Chrome release. We will start with a release of ChromeDriver 73 next week, before the Beta release of Chrome 73.

新发布模型的工作方式如下:

  • ChromeDriver 将使用与 Chrome 相同的版本号方案。参见 https://www.chromium.org/developers/version-numbers了解更多详情。
  • ChromeDriver 的每个版本都将通过匹配的主要版本号、次要版本号和构建版本号来支持 Chrome。例如,即将推出的 ChromeDriver 73.0.3683.* 将支持所有以 73.0.3683 开头的 Chrome 版本。
  • 在 Chrome 的新主要版本进入 Beta 之前,将发布匹配版本的 ChromeDriver。例如,下周将发布新版本的 ChromeDriver,以匹配 Chrome m73 的 Beta 版本。
  • 在新的主要版本首次发布后,我们将根据需要发布补丁。这些补丁可能会或可能不会与 Chrome 更新一致。

关于python - RemoteDisconnected ("Remote end closed connection without"http.client.RemoteDisconnected : Remote end closed connection without response,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53375824/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com