     [Answers](https://scrapfly.io/blog)   /  [python](https://scrapfly.io/blog/tag/python)   /  [How to fix Python requests MissingSchema error?](https://scrapfly.io/blog/answers/python-requests-exception-missingschema)   # How to fix Python requests MissingSchema error?

 by [Bernardas Alisauskas](https://scrapfly.io/blog/author/bernardas) Dec 19, 2022 1 min read [\#python](https://scrapfly.io/blog/tag/python) [\#requests](https://scrapfly.io/blog/tag/requests) 

 [  ](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fpython-requests-exception-missingschema "Share on LinkedIn")    

 

 

`MissingSchema` error can be seen when using Python [requests](https://pypi.org/project/requests/) module to scrape invalid URLs without protocol indicator (the `http://` bit).

This usually happens when we accidently supply the scraper with **relative URLs** instead of **absolute URLs**:

python```python
import requests

requests.get("/product/25")  # default redirect limit is 30
# will raise:
# MissingSchema: Invalid URL '/product/10': No scheme supplied. Perhaps you meant http:///product/10?
```



When web scraping, it's best to always ensure the scraped URLs are absolute using the `urljoin()` function:

python```python
from urllib.parse import urljoin
import requests

response = requests.get("http://example.com")
urls = [  # lets assume we got this batch of product urls:
    "/product/1",
    "/product/2",
    "/product/3",
]

for relative_url in urls:
    absolute_url = urljoin(response.url, relative_url)
    # this will result in: http://example.com/product/1
    item_response = requests.get(absolute_url)
```





 

    



Scale Your Web Scraping

Anti-bot bypass, browser rendering, and rotating proxies, all in one API. Start with 1,000 free credits.

  No credit card required  1,000 free API credits  Anti-bot bypass included 

 [Start Free](https://scrapfly.io/register) [View Docs](https://scrapfly.io/docs/onboarding) 

 Not ready? Get our newsletter instead. 

 

## Explore this Article with AI

 [ ChatGPT ](https://chat.openai.com/?q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fpython-requests-exception-missingschema) [ Gemini ](https://www.google.com/search?udm=50&aep=11&q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fpython-requests-exception-missingschema) [ Grok ](https://x.com/i/grok?text=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fpython-requests-exception-missingschema) [ Perplexity ](https://www.perplexity.ai/search/new?q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fpython-requests-exception-missingschema) [ Claude ](https://claude.ai/new?q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fpython-requests-exception-missingschema) 



 ## Related Articles

 [  

 http 

### What is HTTP 422 Error? (Unprocessable Entity)

422 Unprocessable Entity error is usually caused by a semantically invalid request. Learn http error 422 causes and how ...

 

 ](https://scrapfly.io/blog/posts/what-is-http-422-error-unprocessable-entity) [  

 http 

### What is HTTP 401 Error and How to Fix it

Discover the HTTP 401 error meaning, its causes, and solutions in this comprehensive guide. Learn how 401 unauthorized e...

 

 ](https://scrapfly.io/blog/posts/what-is-http-401-error-and-how-to-fix-it) [  

 http python 

### How to Fix 403 Forbidden Errors When Web Scraping

Learn why web scrapers get 403 Forbidden errors and how to fix them with 7 Python solutions, from headers to TLS fingerp...

 

 ](https://scrapfly.io/blog/posts/403-forbidden-web-scraping) 

  ## Related Questions

- [ Q How to fix python requests ConnectTimeout error? ](https://scrapfly.io/blog/answers/python-requests-exception-connecttimeout)
- [ Q How to fix Python requests TooManyRedirects error? ](https://scrapfly.io/blog/answers/python-requests-exception-toomanyredirects)
- [ Q How to fix Python requests ReadTimeout error? ](https://scrapfly.io/blog/answers/python-requests-exception-readtimeout)
- [ Q How to fix Python requests SSLError? ](https://scrapfly.io/blog/answers/python-requests-exception-sllerror)
 
  



   



 Scale your web scraping effortlessly, **1,000 free credits** [Start Free](https://scrapfly.io/register)