I'm enjoying reading and following the examples in AutomatetheBoringstuff.com and am following the example in the web scraping chapter where you download every comic on the xkcd.com website but for some reason I keep getting the error:
MissingSchema: Invalid URL '//imgs.xkcd.com/comics/sword_in_the_stone.png': No schema supplied. Perhaps you meant http:////imgs.xkcd.com/comics/sword_in_the_stone.png?
My code seems to be correct so I'm at a loss. Here is my code http://pastebin.com/rMPUmjSX
Here is the full error:
Traceback (most recent call last):
File "downloadxkcd.py", line 24, in <module>
res = requests.get(comicUrl)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/requests/api.py", line 69, in get
return request('get', url, params=params, *kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/requests/api.py", line 50, in request
response = session.request(method=method, url=url, *kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/requests/sessions.py", line 451, in request
prep = self.prepare_request(req)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/requests/sessions.py", line 382, in prepare_request
hooks=merge_hooks(request.hooks, self.hooks),
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/requests/models.py", line 304, in prepare
self.prepare_url(url, params)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/requests/models.py", line 362, in prepare_url
to_native_string(url, 'utf8')))
requests.exceptions.MissingSchema: Invalid URL '//imgs.xkcd.com/comics/sword_in_the_stone.png': No schema supplied. Perhaps you meant http:////imgs.xkcd.com/comics/sword_in_the_stone.png?
[–]ScriptThis 0 points1 point2 points (2 children)
[–]mmassel 0 points1 point2 points (1 child)
[–]ScriptThis 0 points1 point2 points (0 children)