the given website enter link description here loads its table data dynamically whenever the scrollbar reaches to the window end point. it also generates a new post request with new Page Index number to load the new data for the table. I want to sent multiple post requests so that I could load all table data and then to scrape it . how can I know what would be the last index number which should be sent along with my request.
import requests
from bs4 import BeautifulSoup
url = 'https://www.ungm.org/Public/Notice/Search'
payload = {
"PageIndex": 0,
"PageSize": 15,
"Title": "",
"Description": "",
"Reference": "",
"PublishedFrom": "",
"PublishedTo": "12-Jul-2020",
"DeadlineFrom": "12-Jul-2020",
"DeadlineTo": "",
"Countries": [],
"Agencies": [],
"UNSPSCs": [],
"NoticeTypes": [],
"SortField": "DatePublished",
"SortAscending": False,
"isPicker": False,
"NoticeTASStatus": [],
"IsSustainable": False,
"NoticeDisplayType": None,
"NoticeSearchTotalLabelId": "noticeSearchTotal",
"TypeOfCompetitions": []
}
I want this line should be executed the number of times eqaul to max of page index.
soup = BeautifulSoup( requests.post(url, json=payload).content, 'html.parser' )