Kappa
Kappa

Reputation: 45

Beautiful Soup parsing table from react html

Im trying to parse table with orders from html page. Here the html:

HTML PIC

I need to get data from those table rows, Here what i tried to do:

response = requests.get('https://partner.market.yandex.ru/supplier/23309133/fulfillment/orders', headers=headers)

soup = BeautifulSoup(response.text, 'lxml')
q = soup.findAll('tr')
a = soup.find('tr')

print(q)
print(a)

But it gives me None. So any idea how to get into those table rows? I tried to iterate over each div in html... once i get closer to div which contains those tables it give me None as well. Appreciate any help

Upvotes: 0

Views: 451

Answers (1)

Kappa
Kappa

Reputation: 45

Aight. I found a solution by using selenium instead of requests lib.

I don't have any idea why it doesn't work with requests lib since it's doing the same thing as selenium (just sending an get request). But, with the selenium it works.

So here is what I do:

driver = webdriver.Chrome(r"C:\Users\Booking\PycharmProjects\britishairways\chromedriver.exe")

driver.get('https://www.britishairways.com/travel/managebooking/public/ru_ru')

time.sleep(15) # make an authorization 
res = driver.page_source
print(res)

soup = BeautifulSoup(res, 'lxml')
b = soup.find_all('tr')

Upvotes: 1

Related Questions