使用python请求模块进行Web抓取时出错

时间:2017-09-13 08:05:24

标签: python python-3.6

尝试使用python 3.6.2获取网站内容。获取以下错误。

requests.exceptions.SSLError: HTTPSConnectionPool(host='www.amazon.in', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_ACCESS_DENIED] tlsv1 alert access denied
 (_ssl.c:748)'),))

代码:

import requests
from bs4 import BeautifulSoup
r=requests.get("https://www.amazon.in/")
r.content

帮我解决这个问题!

2 个答案:

答案 0 :(得分:1)

尝试 http 而不是 https 。它对我有用

答案 1 :(得分:0)

您可以通过键入以下命令来检查您的连接和与TLS协议通信的能力:

openssl s_client -connect www.amazon.in:443

无论如何,你的python代码是正确的,对我有用。

相关问题