Good morning all,
My web scraping program gives me a missing schema invalid URL error, and I do not know how to fix it. I am surely appreciate if someone can lend a helping hand.
My web scraping program gives me a missing schema invalid URL error, and I do not know how to fix it. I am surely appreciate if someone can lend a helping hand.
Error:MissingSchema Traceback (most recent call last)
<ipython-input-44-3fcf85db74c0> in <module>
6 searchdf = pd.DataFrame()
7 for k in reversed(range(len(pagesToParse))):
----> 8 searchdf = searchdf.append(parsePage(pagesToParse[k]), ignore_index=True)
9
10 location_series = pd.Series([counties[j]]*len(searchdf))
<ipython-input-41-85c64130082e> in parsePage(url)
1 def parsePage(url):
----> 2 page = requests.get(url)
3 soup = BeautifulSoup(page.text, "html.parser")
4
5 nameSeries = []
~\Anaconda3\lib\site-packages\requests\api.py in get(url, params, **kwargs)
74
75 kwargs.setdefault('allow_redirects', True)
---> 76 return request('get', url, params=params, **kwargs)
77
78
~\Anaconda3\lib\site-packages\requests\api.py in request(method, url, **kwargs)
59 # cases, and look like a memory leak in others.
60 with sessions.Session() as session:
---> 61 return session.request(method=method, url=url, **kwargs)
62
63
~\Anaconda3\lib\site-packages\requests\sessions.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
514 hooks=hooks,
515 )
--> 516 prep = self.prepare_request(req)
517
518 proxies = proxies or {}
~\Anaconda3\lib\site-packages\requests\sessions.py in prepare_request(self, request)
447
448 p = PreparedRequest()
--> 449 p.prepare(
450 method=request.method.upper(),
451 url=request.url,
~\Anaconda3\lib\site-packages\requests\models.py in prepare(self, method, url, headers, files, data, params, auth, cookies, hooks, json)
312
313 self.prepare_method(method)
--> 314 self.prepare_url(url, params)
315 self.prepare_headers(headers)
316 self.prepare_cookies(cookies)
~\Anaconda3\lib\site-packages\requests\models.py in prepare_url(self, url, params)
386 error = error.format(to_native_string(url, 'utf8'))
387
--> 388 raise MissingSchema(error)
389
390 if not host:
MissingSchema: Invalid URL '/search?search_terms=Private%20Schools%20(K-12)&geo_location_terms=ada%20county%20idaho&page=2': No schema supplied. Perhaps you meant http:///search?search_terms=Private%20Schools%20(K-12)&geo_location_terms=ada%20county%20idaho&page=2?
Larz60+ write Jun-16-2021, 03:06 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time. Please use bbcode tags on future posts.
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time. Please use bbcode tags on future posts.