Prateek Singh
Prateek Singh

Reputation: 39

html5lib Error while scraping and installation

I have been trying to scrape data from a flight website. This is the code I wrote:

todays_date = str(date.today())
arrival_filename = todays_date+"Arrival_Data_IGI.csv"
res = requests.get("https://m.newdelhiairport.in/live-flight- 
 information.aspx?FLMode=A&FLType=D")
soup = BeautifulSoup(res.content,'lxml')
table = soup.find_all('table',{'id':'fids_row'})
df = pd.read_html(str(table))
arrival = df[0]
arrival_filename = todays_date+"_Arrival_Data_IGI.csv"
arrival.to_csv(arrival_filename)
arrival.to_csv("Arrival_Data_IGI(daily).csv")

But an error came when I ran the code. Error that came:

Error that came

When I tried to install html5lib using pip install html5lib, following error came:

Installation Error

Error while installing any library or upgrading pip.

"Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1051)'))) - skipping"

Upvotes: 0

Views: 497

Answers (2)

Monu Yadav
Monu Yadav

Reputation: 570

If you are using Windows, there may at times be issues when installing packages on 64-bit version.

You can download the 64-bit version of the library from here.

Then open Command prompt on the path where you have downloaded the file and type

pip install "name of the package".whl

Since the downloaded file is a wheel file.

Or you can download the required packages from Anaconda-Navigator.

Upvotes: 0

Dmitry
Dmitry

Reputation: 2096

You should upgrade pip. This solution (from this github conversation) can solve the problem:

python -m pip install --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org --upgrade pip

Upvotes: 0

Related Questions