Answer the question
In order to leave comments, you need to log in
How to get around the bad_request, error 007 error when parsing an online grocery store website?
Good day.
I have some experience in Python, but I have never parsed sites and now, if necessary, according to various instructions, I wrote a simple request for request + bs4 and in the html variable tree itself through the debugger I see the following error:
"Bad request"
"Error_code: 007 "
"This request was blocked by security rules"
Code:
import requests
from bs4 import BeautifulSoup as BS
r = requests.get('https://www.okeydostavka.ru/spb/ovoshchi-i-frukty/ovoshchi')
html = BS(r.content, 'html.parser')
Answer the question
In order to leave comments, you need to log in
There is a primitive protection, it checks the User-Agent.
Pretend to be a browser, put down the User-Agent header (you can see the value if you go to the browser and look at the request headers in the debugger) - and you will be happy
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question