'AttributeError: 'NoneType' object has no attribute 'findNextSibling'

I'm trying to parse through a web table and record the values. I keep getting an error (AttributeError: 'NoneType' object has no attribute 'findNextSibling'). I need help with the following:

from bs4 import BeautifulSoup as bs
import requests
import pandas as pd

row_data=[]
condition=True

while condition: 
    url='https://fintel.io/activists'
    page=requests.get(url)
    soup=bs(page.text,'lxml')

    soup
    #getting the table
    table_body=soup.find('table')
   

    for row in table_body.find_all('tr'):
        col=row.find_all('td')
        col=[ele.text.strip() for ele in col]
        row_data.append(col)
    
    pg=soup.find('ul','pagination')
    active_pg=pg.find('li','active')
    next_url=active_pg.findNextSibling('li').a.get('href')
       
    if next_url == "":
        condition=False
    else:
        url=next_url
        
len(row_data)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source