Answer the question
In order to leave comments, you need to log in
Why doesn't the parser return anything?
You need to parse the cost of a product on its Ozon page, but nothing is retrieved from it at all:
request = requests.get('https://www.ozon.ru/product/holodilnik-indesit-tia-180-belyy-277079362/', HEADERS)
page = BeautifulSoup(request.content, 'lxml')
print(page)
Answer the question
In order to leave comments, you need to log in
Add 'User-Agent' key to headers
For example
'User-Agent': 'PostmanRuntime/7.28.1'
import requests
from bs4 import BeautifulSoup
import lxml
url = "https://www.ozon.ru/product/holodilnik-indesit-tia-180-belyy-277079362/"
payload = {}
headers = {
'User-Agent': 'PostmanRuntime/7.28.1',
'Cookie': 'ЗДЕСЬ КУКИ'}
response = requests.request("GET", url, headers=headers, data=payload)
page = BeautifulSoup(response.content, 'lxml')
print(page)
<div id="state-webPrice-836055-default-1"
data-state='{"isAvailable":true,"price":"17 990 ₽","originalPrice":"20 390 ₽","showOriginalPrice":true,"mode":"credit","payment":"1 799 ₽","paymentTerm":"12 мес","hintLink":"https:\u002F\u002Fwww.ozon.ru\u002Fsection\u002Fcredit\u002F","hintText":"Приблизительный расчет. Платеж зависит от срока и типа кредитного продукта"}'>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question