0

My code is returning an error message, but i don't know why, I've done this same logic many times before and never happened nothing like this, code below:

import requests
from bs4 import BeautifulSoup

site = 'https://www.fea.usp.br/internacional/universidades-conveniadas?pais=All'
req = requests.get(site)

Error message:

- SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)
- MaxRetryError: HTTPSConnectionPool(host='www.fea.usp.br', port=443): Max retries exceeded with url: /internacional/universidades-conveniadas?pais=All (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)')))
- SSLError: HTTPSConnectionPool(host='www.fea.usp.br', port=443): Max retries exceeded with url: /internacional/universidades-conveniadas?pais=All (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)')))
President James K. Polk
  • 40,516
  • 21
  • 95
  • 125
  • You may not have the issuer root certificate in your list of trusted CAs. See the requests documentation to correct that situation. – President James K. Polk Dec 23 '20 at 17:47
  • In short: the server is not properly setup to provide all necessary intermediate certificates. See [the SSLLabs report](https://www.ssllabs.com/ssltest/analyze.html?d=www.fea.usp.br). Recommendations on how to work around the problem are provided in the linked questions. – Steffen Ullrich Dec 23 '20 at 18:10

1 Answers1

-1

The SSL certificate of the website maybe be expired, you can bypass it by making your request like this:

req = request.get(site, verify=False)

This will generate a warning, though you can suppress it.

Jarvis
  • 8,494
  • 3
  • 27
  • 58