TypeError: Tag.find_all() missing 1 required positional argument: 'self' при парсинге сайта
import requests
from bs4 import BeautifulSoup
import os
soup = BeautifulSoup
url = "https://health-diet.ru/table_calorie"
headers = {
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
"User_Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36 Edg/113.0.1774.57"
}
req = requests.get(url, headers=headers)
src = req.text
# print(src)
# with open("index.html", "w", encoding="utf-8") as file:
# file.write(src)
with open("index.html", encoding="utf-8") as file:
src = file.read()
all_product = soup.find(class_ = "uk-grid uk-grid-medium").find_all(class_ = "mzr-tc-group-item-href")
print(all_product)
Ответы (1 шт):
Автор решения: wchistow
→ Ссылка
Метод find_all принимает обязательный аргумент name, обозначающий имя тега, а вы его не передали.