A
A
Aghanimoff2022-01-17 04:21:30
Python
Aghanimoff, 2022-01-17 04:21:30

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')

Target site:
https://www.okeydostavka.ru/spb/tovary-dlia-zhivot...

Tell me , what is the error and how can I fix it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
cunning-seal, 2022-01-17
@cunning-seal

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 question

Ask a Question

731 491 924 answers to any question