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

12,011

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

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

Hope that helps.

Share:
12,011
Admin
Author by

Admin

Updated on June 04, 2022

Comments

  • Admin
    Admin almost 2 years

    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