Парсер Python. Не могу написать пагинацию

Всем привет! Помогите понять в чем проблема. Пишу впервые парсер каталога магазина, но столкнулся с такой проблемой. В общем, у меня никак не получается найти и вывести в диве пагинатора значения следующих страниц, которые мне необходимы для корректной работы цикла "page". Вот тут html сайта. Буду благодарен!

import requests
from bs4 import BeautifulSoup
import pandas as pd
#%%
data = []
page = 1
max_page = 1
#%%
res =  requests.get(f'https://s2brf.ru/catalog/tabak/?page={page}')
soup = BeautifulSoup(res.text, 'html')
elements = soup.find_all('div', class_='col-lg-3 col-md-4 col-sm-6 col-xs-6 col-xxs-12 item item-parent item_block')
pagin = soup.find('div', class_='nums')

for e in elements:
        data.append({
            'name': e.find('a', class_='dark_link option-font-bold font_sm').text.strip(),
            'price': e.find('div', class_='price font-bold font_mxs').text.strip().replace('\xa0', '').replace('руб', ''),
        })

#%%
while page <= max_page:
    res =  requests.get(f'https://s2brf.ru/catalog/tabak/?page={page}')
    soup = BeautifulSoup(res.text, 'html')
    elements = soup.find_all('div', class_='col-lg-3 col-md-4 col-sm-6 col-xs-6 col-xxs-12 item item-parent item_block')

    for e in elements:
        data.append({
            'name': e.find('a', class_='dark_link option-font-bold font_sm').text.strip(),
            'price': e.find('div', class_='price font-bold font_mxs').text.strip().replace('\xa0', '').replace('руб', ''),
        })

    pagination = soup.find('div', class_='nums')
    pages = [int(p.text.strip()) for p in pagination.find.all('a',class_='dark_link')]
    int_pages = []

    for p in pages:
        try:
            n = int(p)
            int_pages.append(n)
        except:
            continue

    max_page = max(int_pages)
    page += 1
    
df = pd.DataFrame(data)
df

Получаю вот такую ошибку:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[259], line 13
      7     data.append({
      8         'name': e.find('a', class_='dark_link option-font-bold font_sm').text.strip(),
      9         'price': e.find('div', class_='price font-bold font_mxs').text.strip().replace('\xa0', '').replace('руб', ''),
     10     })
     12 pagination = soup.find('div', class_='nums')
---> 13 pages = [int(p.text.strip()) for p in pagination.find.all('a', class_='dark_link')]
     14 int_pages = []
     16 for p in pages:

AttributeError: 'function' object has no attribute 'all'

Ответы (0 шт):