403 error when loading a web page
Quessts opened this issue · 1 comments
Before creating an issue, first upgrade cfscrape with pip install -U cfscrape
and see if you're still experiencing the problem. Please also confirm your Node version (node --version
or nodejs --version
) is version 10 or higher.
Make sure the website you're having issues with is actually using anti-bot protection by Cloudflare and not a competitor like Imperva Incapsula or Sucuri. And if you're using an anonymizing proxy, a VPN, or Tor, Cloudflare often flags those IPs and may block you or present you with a captcha as a result.
Please confirm the following statements and check the boxes before creating an issue:
- I've upgraded cfscrape with
pip install -U cfscrape
- I'm using Node version 10 or higher
- The site protection I'm having issues with is from Cloudflare
- I'm not using Tor, a VPN, or an anonymizing proxy
Python version number
Run python --version
and paste the output below:
3.7.9
cfscrape version number
Run pip show cfscrape
and paste the output below:
2.1.1
Code snippet involved with the issue
import cfscrape
s = cfscrape.create_scraper()
headers = {
'authorization': 'discord token',
'Content-Type': 'application/json',
'user-agent': 'user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36'
}
json = {
'content': 'message'
}
r = s.post('https://discordapp.com/api/v6/channels/597890559423807519/messages',
headers=headers, json=json)
print(r.status_code)
print(r.content)
URL of the Cloudflare-protected page
https://discordapp.com/api/v6/channels/597890559423807519/messages
URL of Pastebin/Gist with HTML source of protected page
in 'user-agent': 'user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36'
I had 'user-agent"
written down twice. My bad! closing this issue now