A 403 Forbidden response to your scraper means the server understood the request and refused to process it. It is a refusal, not a temporary fault. MDN's 403 reference states that "repeating the request without modification will fail with the same error," so retry loops only produce more 403s.
The refusal is "tied to application logic, such as insufficient permissions to a resource or action." Before you change your code, find out what the server is refusing and why.
Why does a retried 403 request keep failing?
A retried 403 fails because the server's decision has not changed. MDN describes the status as the server choosing not to serve this request, and adds that "for 403 Forbidden responses, authenticating or re-authenticating makes no difference."
The consequence for a scraper is direct:
- Backoff and retry logic designed for timeouts or 5xx errors does nothing for a 403.
- Logging in again does not turn a 403 into a 200.
- A 404 can hide a 403. MDN notes that server owners "may decide to send a 404 response instead of a 403" when they do not want to confirm a resource exists.
Where does Cloudflare say why it refused the request?
If the site uses Cloudflare, the reason is often in the HTML body, not in the status line. Cloudflare's 1XXX error reference explains the split: "HTTP errors such as 409, 530, 403, and 429 are returned in the HTTP status header of a response, while 1XXX errors appear in the HTML body of the response."
Your script sees 403. The page it received may also say Error 1020 or Error 1006. Read that code before you change anything. As of November 2026, the reference lists these codes as returned with HTTP 403:
| Code | Cloudflare title | What the code points at |
|---|---|---|
| 1003 | Access Denied: Direct IP Access Not Allowed | A request addressed to an IP address instead of the hostname |
| 1005 | Access Denied: Autonomous System Number (ASN) banned | The network the request came from |
| 1006, 1007, 1008, 1106 | Access Denied: Your IP address has been banned | The IP address the request came from |
| 1009 | Access Denied: Country or region banned | The country or region of the request |
| 1010 | The owner of this website has banned your access based on your browser's signature | The client's signature |
| 1020 | Access denied | A denial by the site; the title names no specific cause |
Of these codes, 1003 is the one you can usually fix in the request itself: Cloudflare shows it when a request is addressed to an IP address in its network instead of the site's hostname, so send the request to the hostname. The other codes describe a decision the site owner made about your IP, network, region or client. If you hit one in a regular browser instead of a script, the Cloudflare "Sorry, you have been blocked" page covers that version.
What should you check in your Python Requests call?
A Requests script returning 403 should first be checked for what it actually sends. The Requests Quickstart says the library "does not change its behavior at all based on which custom headers are specified. The headers are simply passed on into the final request." What you write is what goes out, with the exceptions covered below.
1import requests2 3url = "https://example.com/page"4headers = {"user-agent": "my-app/0.0.1"} # identify your client honestly5 6r = requests.get(url, headers=headers, timeout=10)7 8print(r.status_code)9print(r.request.headers) # what was actually sent10if r.status_code == 403:11 print(r.text[:2000]) # look for a Cloudflare 1XXX code in the body12 13r.raise_for_status()Work through these points in order:
- Headers are a dict of strings. Pass them with
headers=. "All header values must be a string, bytestring, or unicode," and the docs advise against unicode values. A clearuser-agentmakes your requests identifiable. Treat it as correctness, not as a key that opens the page. - Check the status explicitly. "Response.raise_for_status() will raise an HTTPError if the HTTP request returned an unsuccessful status code." The Quickstart illustrates this with a
404 Client Error. A 403 is also an unsuccessful status, so the same call stops your script before it parses a refusal page as data. - Cookies you legitimately hold. If a page you have access to depends on a cookie, send it with the
cookiesparameter, as the Quickstart shows. - Authorization precedence. An
Authorizationheader set withheaders="will be overridden if credentials are specified in .netrc, which in turn will be overridden by the auth= parameter." Also, "Authorization headers will be removed if you get redirected off-host." Printr.request.headersto confirm which credentials went out, so you know which account's permissions the server judged. - Redirect loops. Exceeding the maximum redirects raises
TooManyRedirects. A login or consent page that redirects in circles can show up as this exception instead of a status code.
For proxy configuration in the same library, see Python Requests proxy setup. If the script is one step in a larger pipeline or an agent, agentic web scraping and where it breaks covers the failure points beyond a single request.
Which IP and network is the site actually seeing?
The IP address and network your request comes from are what codes 1005, 1006 to 1008, 1106 and 1009 refer to. A script that worked on your laptop and returns 403 on a server is sending requests from the server's address and network, not your home connection.
From a browser on the same network, the check below shows the IP, network and location a site sees. On a headless server, run curl https://ipinfo.io/json from the machine itself (the curl guide covers the flags).
What does your IP reveal right now?
Knowing the address tells you what the code is about. A different address does not make your requests acceptable to the site.
What should you do when the 403 is a block?
A 403 with a 1XXX code from the ban rows is the site owner's decision. Treat it as an answer:
- Stop the requests that triggered it. Repeating them changes nothing, per MDN.
- Check that you have permission. Review the site's terms and robots rules for the paths you collect. Look for an official API or data export.
- Contact the site owner. Cloudflare's reference states: "Only the website owner can contact Cloudflare for technical support. You can find a domain's contact details via the Whois database." Explain who you are, what you collect, how often, and from which addresses.
Cloudflare's own support tiers also run through the owner. "Pro, Business and Enterprise plan users have access to email support. Business and Enterprise users can also access chat support."
Do mobile proxies fix a 403 Forbidden?
No. A mobile proxy does not turn a refusal into permission. A 403 is the site's decision about your request, and routing it through another network leaves that decision in place.
Mobile proxies fit permitted collection that needs mobile network routing, such as viewing region-specific pages or prices as a local mobile user would. VoidMob's mobile proxies exit through real 4G/5G devices on consumer carrier connections. Shared pay-per-GB packages start at $3.99 per GB, at one price whatever the exit country. Setups for that work are on the mobile proxies for web scraping page.
Does logging in fix a 403 Forbidden?
No. MDN states that for 403 Forbidden responses, authenticating or re-authenticating makes no difference. The server understood the request and refused it based on its own rules.
Why did I get a 404 instead of a 403?
MDN notes that server owners may send a 404 instead of a 403 when they do not want to confirm a resource exists to clients without permission. A 404 on a page you can see in a browser can be a refusal in disguise.
Where is the Cloudflare 1020 code in a 403 response?
In the HTML body. Cloudflare returns the 403 in the status header and the 1XXX code in the body of the page, so print or log response.text to read it.
Can I contact Cloudflare about a 403 myself?
Cloudflare states that only the website owner can contact it for technical support. Find the domain's contact details through the Whois database and write to the owner.
Why does my Python scraper hang instead of returning an error?
No timeout is set. The Requests docs say that if no timeout is specified explicitly, requests do not time out, and that nearly all production code should pass the timeout parameter in nearly all requests.
Mobile routing for permitted data collection
Real 4G/5G devices on consumer carrier connections, as a pay-per-GB pool or a dedicated device.