1

I am trying to save a buch of scraped data to a csv file with python, but I am keep getting time out errors, don't really know how to go about it, what Should I do?

what I have tried


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")

these are the errors that I am getting

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]

1 Answers1

0

because of network problem , maybe try with headers or check out this Why can't I get Python's urlopen() method to work on Windows?

Sandiph Bamrel
  • 137
  • 1
  • 13