【发布时间】:2021-08-20 06:12:00
【问题描述】:
我目前正在尝试从我的称重设备上进行网络抓取。我的称重设备有一个称重传感器和一个控制器。控制器通过以太网连接到我的笔记本电脑。控制器具有内置的网络服务器,因此我可以通过 chrome 浏览器使用指定的 IP 地址 192.168.0.2 访问控制器并切换任何设置并获取重量数据。
我有兴趣使用 python 和提供的 IP 地址从网络服务器上抓取重量数据。我的代码如下:
import requests
import bs4
result = requests.get("http://192.168.0.2")
soup = bs4.BeautifulSoup(result.text,"lxml")
x = soup.select('#DisplayWeight')
print(x)
但是,我收到以下错误:
-
TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond -
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x000001B2A1EB2820>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond -
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='192.168.0.2', port=80): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000001B2A1EB2820>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond')) -
requests.exceptions.ConnectionError: HTTPConnectionPool(host='192.168.0.2', port=80): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000001B2A1EB2820>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond'))
我不明白出了什么问题,我尝试寻找答案。我可以在这方面寻求帮助吗?谢谢。
最好的问候
【问题讨论】:
标签: python web-scraping ethernet