我正在尝试使用python将大量抓取的数据保存到一个csv文件中,但是我一直在超时错误,不知道该怎么办,我该怎么办?
我尝试过的
import pandas as pd
import urllib.request
from bs4 import BeautifulSoup as b
npo_codici ={}
codici_no = 0
df = pd.read_excel("led-italia_lampadine.xlsx","foglio1")
sku = df["codice SKU"].tolist()
rounded_sku = [round(x) for x in sku]
request_length = len(rounded_sku)
for e in range(request_length):
request = str(rounded_sku[e])
e+=1
base_url = "https://v-tac.it/led-products-results-page/?q="
url = base_url + request
html = urllib.request.urlopen(url).read()
soup = b(html, "html.parser")
这些是我得到的错误
File "C:\Users\antonella\AppData\Local\Programs\Python\Python37-32\lib\urllib\request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "C:\Users\antonella\AppData\Local\Programs\Python\Python37-32\lib\urllib\request.py", line 525, in open
response = self._open(req, data)
File "C:\Users\antonella\AppData\Local\Programs\Python\Python37-32\lib\urllib\request.py", line 543, in _open
'_open', req)
File "C:\Users\antonella\AppData\Local\Programs\Python\Python37-32\lib\urllib\request.py", line 503, in _call_chain
result = func(*args)
File "C:\Users\antonella\AppData\Local\Programs\Python\Python37-32\lib\urllib\request.py", line 1360, in https_open
context=self._context, check_hostname=self._check_hostname)
File "C:\Users\antonella\AppData\Local\Programs\Python\Python37-32\lib\urllib\request.py", line 1319, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [WinError 10060]