
import requests
from bs4 import BeautifulSoup

url = 'https://www.parsemachine.com/sandbox/catalog/'
headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3'
}
response = requests.get(url, headers=headers)
soup = BeautifulSoup(response.content, 'html.parser')
product_list = soup.find_all('div', {'class': 'card-body'})
print(product_list)

count = 0
counter = 1
while count < 100:
    for product in product_list:
        name = product.find('h6', {'class': 'card-title'}).text.strip()
        price = product.find('span', {'class': 'selector'})
        count += 1
        new_url = (url + 'tovar-' + str(count))
        new_response = requests.get(new_url, headers=headers)
        new_soup = BeautifulSoup(new_response.content, 'html.parser')
        print(url + 'tovar-' + str(count))
        try:
            price = new_soup.find("p", {"class": "mt-0 mb-0"}).text.strip()
            characteristics = new_soup.find('table', {'class': 'table table-hover mb-2'}).text.strip()
         #   print(f'{name}\n{price}\nХарактеристики: \n{characteristics.strip(" ")}\n')
        except AttributeError:
            pass





