我正在尝试连接到一个网页。这是我的代码:
class AddNewSite():
def __init__(self, url, user=None, email=None, category=None,
subcategory=None, date_end=None):
self.url = url
self.user = user
self.email = email
req = Request(self.url, headers={'user-agent': 'Mozilla/5.0
(Macintosh; Intel Mac OS X 10_9_3) \
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 \
Safari/537.36'})
self.page = urlopen(req).read()
self.soup = BeautifulSoup(self.page)
self.meta = self.soup.find_all('meta')
在我的视图.py(这是一个Django项目)我有:
^{pr2}$在本地主机上一切正常。它连接到站点没有eny错误。在生产服务器上,我遇到了一个异常。下面我从日志中粘贴错误。在
HTTPConnectionPool(host='exeo.pl', port=80): Max retries exceeded with url:
/ (Caused by
NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection
object at 0x80897ff98>: Failed to establish a new connection: [Errno 60]
Operation timed out',))
HTTPConnectionPool(host='exeo.pl', port=80): Max retries exceeded with url:
/ (Caused by
NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection
object at 0x80940aeb8>: Failed to establish a new connection: [Errno 60]
Operation timed out',))
HTTPConnectionPool(host='exeo.pl', port=80): Max retries exceeded with url:
/ (Caused by
NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection
object at 0x80949fdd8>: Failed to establish a new connection: [Errno 60]
Operation timed out',))
<urllib.request.Request object at 0x808b92048>
为什么问题只存在于生产服务器上?在
目前没有回答
相关问题 更多 >
编程相关推荐