在Generator电子邮件站点中使用Python请求



当我尝试以下http代码从generator.email站点获取链接时,我总是会收到这个错误

requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

这是我尝试的代码

headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36',
'Accept-Encoding': 'gzip, deflate, br',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
'Accept-Language': 'en-US,en;q=0.9',
}
cookies = {'surl':'6jorge19753f@timjarrett.net'}
email = '6jorge19753f@timjarrett.net'
url = f'https://generator.email/{email}'
# url = 'https://generator.email/ '
print(url)
response = requests.get(url, headers=headers, cookies=cookies)
print(response.content)
quit()

我该如何解决此问题?我试过使用和不使用标题和cookie,但都不起作用。

import requests
start_url="https://generator.email/"
page_data=requests.get(start_url)
print(page_data.content)

这给出了正确的输出,我没有发布输出,因为它是很长的

还有

print(page_data)

输出

<Response [200]>

这意味着请求已成功发送

在start_url中添加了电子邮件id后,它给出了错误

raise RemoteDisconnected("Remote end closed connection without"
" response")
#many lines were there have not copied the entire thing though but this is the main problem

要查看有关此错误的更多信息,请查看此链接Python HTTP服务器/客户端:远程结束关闭的连接而没有响应错误

最新更新