Hedi Hadi
Hedi Hadi

Reputation: 33

How to replicate this javascript onclick using requests?

I have this button in a website:

<a data-page-number="6" data-offset="150" href="website.com/etc.html" class="pageNum taLnk" onclick="      require('common/Radio')('restaurant-filters').emit('paginate', this.getAttribute('data-offset'));; ta.trackEventOnPage('STANDARD_PAGINATION', 'page', '6', 0); return false;
  ">
6
</a>

The website shows a list, and to move to page list 1,2,3,etc.. you have to click on the above button, the data-offset is what controls which page list the website is showing.

I want to replicate clicking on this button using requests, is that possible?

Upvotes: 0

Views: 104

Answers (1)

Hedi Hadi
Hedi Hadi

Reputation: 33

i was able to send the "data-offset" attribute manually by using this code

requests.get('url', params={"data-offset":"2220"}).text

Upvotes: 2

Related Questions