I want to handle http.client.BadStatusLine: ''
exception.
I am on python3. My code is
import http.client
try:
req = urllib.request.Request(url, headers={'User-Agent': 'Chrome/51'})
html = urllib.request.urlopen(req).read()
soup = BeautifulSoup(html,"html.parser")
return soup
except http.client.HTTPException as eror:
print("Boom")
but httpException
is not in python3?
I read stackOverFloeQuestion and this but unable to catch it. Any help?