Invalid URL: No host supplied : error while using Request.get(url) in Python

22.5k views Asked by At

Code:

img=requests.get('http:////files.explosm.net/comics/Rob/chainsaw.png')

Error Message:

requests.exceptions.InvalidURL: Invalid URL u'http://files.explosm.net/comics/Rob/chainsaw.png': No host supplied

What's wrong with the url? files.explosm.net/comics/Rob/chainsaw.png

1

There are 1 answers

0
hd1 On

You have a few too many '/'s in the URL:

img = requests.get('http://files.explosm.net/comics/Rob/chainsaw.png')

Hope that helps.