<pre lang="Python">import requests
from bs4 import BeautifulSoup
import re
import json
def lol(url):
with requests.Session() as req:
r = req.get(url)
soup = BeautifulSoup(r.content, 'html.parser')
vs = soup.find("input", id="__VIEWSTATE").get("value")
ev = soup.find("input", id="__EVENTVALIDATION").get("value")
data = {
"__EVENTTARGET": "",
"__EVENTARGUMENT": "",
"__VIEWSTATE": vs,
"__VIEWSTATEGENERATOR": "FE3EF141",
"": [
"{2}",
""
],
"ctl00_rwmWindowManager_ClientState": "",
"ctl00_rwTimeoutWarning_ClientState": "",
"s": "",
"ctl00$PageContent$orgOption": "rbHaveOrg",
"ctl00$PageContent$ddlOrganization": "-",
"ddlOrganization_ClientState": "{\"logEntries\":[],\"value\":\"048447c3-0007-c47b-7c9e-0b3e39483880\",\"text\":\"-\",\"enabled\":true}",
"ctl00$PageContent$tbLoginID": "",
"ctl00$PageContent$tbPassword": "",
"ctl00$PageContent$tbConfirmPassword": "",
"ctl00$PageContent$tbIndividualFirstName": "",
"ctl00$PageContent$tbIndividualLastName": "",
"ctl00$PageContent$tbIndividualSuffix": "",
"ctl00_PageContent_tbIndividualSuffix_ClientState": "{\"logEntries\":[],\"value\":\"\",\"text\":\"\",\"enabled\":true}",
"ctl00$PageContent$tbIndividualEmail": "",
"ctl00$PageContent$gvIndividualPhoneNumbers$ctl02$tbIndividualPhoneNumber": "",
"ctl00$PageContent$gvIndividualPhoneNumbers$ctl03$tbIndividualPhoneNumber": "",
"ctl00$PageContent$rptIndividualAddresses$ctl00$hfIndividualAddressCode": "Home",
"ctl00$PageContent$rptIndividualAddresses$ctl00$acIndividualAddress$Line1": "",
"ctl00$PageContent$rptIndividualAddresses$ctl00$acIndividualAddress$Line2": "",
"ctl00$PageContent$rptIndividualAddresses$ctl00$acIndividualAddress$PostalCode": "",
"ctl00$PageContent$rptIndividualAddresses$ctl00$acIndividualAddress$City": "",
"ctl00$PageContent$rptIndividualAddresses$ctl00$acIndividualAddress$State": "",
"ctl00_PageContent_rptIndividualAddresses_ctl00_acIndividualAddress_State_ClientState": "{\"logEntries\":[],\"value\":\"\",\"text\":\"\",\"enabled\":true}",
"ctl00$PageContent$rptIndividualAddresses$ctl00$acIndividualAddress$Country": "No Country",
"ctl00_PageContent_rptIndividualAddresses_ctl00_acIndividualAddress_Country_ClientState": "{\"logEntries\":[],\"value\":\"\",\"text\":\"No Country\",\"enabled\":true}",
"ctl00$PageContent$rptIndividualAddresses$ctl00$acIndividualAddress$County": "",
"ctl00$PageContent$rptIndividualAddresses$ctl00$acIndividualAddress$CongressionalDistrict": "",
"ctl00$PageContent$rptIndividualAddresses$ctl00$acIndividualAddress$CASSCertificationDate": "",
"ctl00$PageContent$rptIndividualAddresses$ctl00$acIndividualAddress$CarrierRoute": "",
"ctl00$PageContent$rptIndividualAddresses$ctl00$acIndividualAddress$DeliveryPointCheckDigit": "",
"ctl00$PageContent$rptIndividualAddresses$ctl00$acIndividualAddress$DeliveryPointCode": "",
"ctl00$PageContent$rptIndividualAddresses$ctl01$hfIndividualAddressCode": "Work",
"ctl00$PageContent$rptIndividualAddresses$ctl01$acIndividualAddress$Line1": "",
"ctl00$PageContent$rptIndividualAddresses$ctl01$acIndividualAddress$Line2": "",
"ctl00$PageContent$rptIndividualAddresses$ctl01$acIndividualAddress$PostalCode": "",
"ctl00$PageContent$rptIndividualAddresses$ctl01$acIndividualAddress$City": "",
"ctl00$PageContent$rptIndividualAddresses$ctl01$acIndividualAddress$State": "",
"ctl00_PageContent_rptIndividualAddresses_ctl01_acIndividualAddress_State_ClientState": "{\"logEntries\":[],\"value\":\"\",\"text\":\"\",\"enabled\":true}",
"ctl00$PageContent$rptIndividualAddresses$ctl01$acIndividualAddress$Country": "No Country",
"ctl00_PageContent_rptIndividualAddresses_ctl01_acIndividualAddress_Country_ClientState": "{\"logEntries\":[],\"value\":\"\",\"text\":\"No Country\",\"enabled\":true}",
"ctl00$PageContent$rptIndividualAddresses$ctl01$acIndividualAddress$County": "",
"ctl00$PageContent$rptIndividualAddresses$ctl01$acIndividualAddress$CongressionalDistrict": "",
"ctl00$PageContent$rptIndividualAddresses$ctl01$acIndividualAddress$CASSCertificationDate": "",
"ctl00$PageContent$rptIndividualAddresses$ctl01$acIndividualAddress$CarrierRoute": "",
"ctl00$PageContent$rptIndividualAddresses$ctl01$acIndividualAddress$DeliveryPointCheckDigit": "",
"ctl00$PageContent$rptIndividualAddresses$ctl01$acIndividualAddress$DeliveryPointCode": "",
"ctl00$PageContent$ddlIndividualPreferredAddress": "048447c3-000f-c2ac-8bfc-0b3d04988fbc",
"ctl00$PageContent$chkDoNotMail": "on",
"ctl00$PageContent$chkDoNotFax": "on",
"ctl00_PageContent_dlbMessageCategories_lbSrc_ClientState": "{\"isEnabled\":true,\"logEntries\":[],\"selectedIndices\":[],\"checkedIndices\":[],\"scrollPosition\":0}",
"ctl00_PageContent_dlbMessageCategories_lbDest_ClientState": "{\"isEnabled\":true,\"logEntries\":[],\"selectedIndices\":[],\"checkedIndices\":[],\"scrollPosition\":0}",
"ctl00$PageContent$cfsIndividualCustomFields$TextBox1": "",
"ctl00$PageContent$cfsIndividualCustomFields$TextBox3": "",
"ctl00$PageContent$cfsIndividualCustomFields$TextBox4": "",
"ctl00$PageContent$cfsIndividualCustomFields$RadComboBox5": "---- Select ----",
"ctl00_PageContent_cfsIndividualCustomFields_RadComboBox5_ClientState": "{\"logEntries\":[],\"value\":\"\",\"text\":\"---- Select ----\",\"enabled\":true}",
"ctl00$PageContent$cfsIndividualCustomFields$RadComboBox6": "---- Select ----",
"ctl00_PageContent_cfsIndividualCustomFields_RadComboBox6_ClientState": "{\"logEntries\":[],\"value\":\"\",\"text\":\"---- Select ----\",\"enabled\":true}",
"ctl00$PageContent$cfsIndividualCustomFields$RadComboBox7": "---- Select ----",
"ctl00_PageContent_cfsIndividualCustomFields_RadComboBox7_ClientState": "{\"logEntries\":[],\"value\":\"\",\"text\":\"---- Select ----\",\"enabled\":true}",
"ctl00$PageContent$cfsIndividualCustomFields$RadComboBox8": "---- Select ----",
"ctl00_PageContent_cfsIndividualCustomFields_RadComboBox8_ClientState": "{\"logEntries\":[],\"value\":\"\",\"text\":\"---- Select ----\",\"enabled\":true}",
"ctl00_PageContent_cfsIndividualCustomFields_DualListBox9_lbSrc_ClientState": "{\"isEnabled\":true,\"logEntries\":[],\"selectedIndices\":[],\"checkedIndices\":[],\"scrollPosition\":0}",
"ctl00_PageContent_cfsIndividualCustomFields_DualListBox9_lbDest_ClientState": "{\"isEnabled\":true,\"logEntries\":[],\"selectedIndices\":[],\"checkedIndices\":[],\"scrollPosition\":0}",
"ctl00_PageContent_cfsIndividualCustomFields_DualListBox10_lbSrc_ClientState": "{\"isEnabled\":true,\"logEntries\":[],\"selectedIndices\":[],\"checkedIndices\":[],\"scrollPosition\":0}",
"ctl00_PageContent_cfsIndividualCustomFields_DualListBox10_lbDest_ClientState": "{\"isEnabled\":true,\"logEntries\":[],\"selectedIndices\":[],\"checkedIndices\":[],\"scrollPosition\":0}",
"ctl00$PageContent$cfsIndividualCustomFields$RadDatePicker11": "",
"ctl00_PageContent_cfsIndividualCustomFields_RadDatePicker11_dateInput_text": "",
"ctl00$PageContent$cfsIndividualCustomFields$RadDatePicker11$dateInput": "",
"ctl00_PageContent_cfsIndividualCustomFields_RadDatePicker11_dateInput_ClientState": "{\"enabled\":true,\"emptyMessage\":\"\",\"minDateStr\":\"1/1/1 0:0:0\",\"maxDateStr\":\"12/31/9999 0:0:0\"}",
"ctl00_PageContent_cfsIndividualCustomFields_RadDatePicker11_calendar_SD": "[]",
"ctl00_PageContent_cfsIndividualCustomFields_RadDatePicker11_calendar_AD": "[[1,1,1],[9999,12,31],[2020,3,24]]",
"ctl00_PageContent_cfsIndividualCustomFields_RadDatePicker11_ClientState": "{\"minDateStr\":\"1/1/0001 0:0:0\",\"maxDateStr\":\"12/31/9999 0:0:0\"}",
"ctl00$PageContent$cfsIndividualCustomFields$RadComboBox12": "---- Select ----",
"ctl00_PageContent_cfsIndividualCustomFields_RadComboBox12_ClientState": "{\"logEntries\":[],\"value\":\"\",\"text\":\"---- Select ----\",\"enabled\":true}",
"ctl00$PageContent$cfsIndividualCustomFields$RadComboBox13": "---- Select ----",
"ctl00_PageContent_cfsIndividualCustomFields_RadComboBox13_ClientState": "{\"logEntries\":[],\"value\":\"\",\"text\":\"---- Select ----\",\"enabled\":true}",
"ctl00$PageContent$cfsIndividualCustomFields$RadComboBox14": "---- Select ----",
"ctl00_PageContent_cfsIndividualCustomFields_RadComboBox14_ClientState": "{\"logEntries\":[],\"value\":\"\",\"text\":\"---- Select ----\",\"enabled\":true}",
"ctl00$PageContent$cfsIndividualCustomFields$RadComboBox15": "---- Select ----",
"ctl00_PageContent_cfsIndividualCustomFields_RadComboBox15_ClientState": "{\"logEntries\":[],\"value\":\"\",\"text\":\"---- Select ----\",\"enabled\":true}",
"ctl00$PageContent$cfsIndividualCustomFields$TextBox16": "",
"ctl00_PageContent_cfsIndividualCustomFields_DualListBox17_lbSrc_ClientState": "{\"isEnabled\":true,\"logEntries\":[],\"selectedIndices\":[],\"checkedIndices\":[],\"scrollPosition\":0}",
"ctl00_PageContent_cfsIndividualCustomFields_DualListBox17_lbDest_ClientState": "{\"isEnabled\":true,\"logEntries\":[],\"selectedIndices\":[],\"checkedIndices\":[],\"scrollPosition\":0}",
"ctl00$PageContent$cfsIndividualCustomFields$TextBox18": "",
"ctl00$PageContent$cfsIndividualCustomFields$RadComboBox19": "---- Select ----",
"ctl00_PageContent_cfsIndividualCustomFields_RadComboBox19_ClientState": "{\"logEntries\":[],\"value\":\"\",\"text\":\"---- Select ----\",\"enabled\":true}",
"ctl00$PageContent$cfsIndividualCustomFields$RadComboBox20": "---- Select ----",
"ctl00_PageContent_cfsIndividualCustomFields_RadComboBox20_ClientState": "{\"logEntries\":[],\"value\":\"\",\"text\":\"---- Select ----\",\"enabled\":true}",
"ctl00_PageContent_cfsIndividualCustomFields_DualListBox21_lbSrc_ClientState": "{\"isEnabled\":true,\"logEntries\":[],\"selectedIndices\":[],\"checkedIndices\":[],\"scrollPosition\":0}",
"ctl00_PageContent_cfsIndividualCustomFields_DualListBox21_lbDest_ClientState": "{\"isEnabled\":true,\"logEntries\":[],\"selectedIndices\":[],\"checkedIndices\":[],\"scrollPosition\":0}",
"__CALLBACKID": "ctl00$PageContent$ddlOrganization",
"__CALLBACKPARAM": "{\"Command\":\"LOD\",\"Text\":\"-\",\"ClientState\":{\"value\":\"\",\"text\":\"\",\"enabled\":true,\"logEntries\":[]},\"Context\":{\"Text\":\"-\",\"NumberOfItems\":40},\"NumberOfItems\":40}",
"__EVENTVALIDATION": ev
}
r = requests.post(url, data=data)
try:
goal = re.search(r"\=(\[.+])", r.text).group(1)
except:
goal = None
clear = json.loads(goal)
print(json.dumps(clear, indent=4))
lol("https://cmt.ps.membersuite.com/profile/CreateAccount_CreateUser.aspx")
What I have tried:
Consider that it's giving you the first 20 rows :) but no worries. You can loop over the POST request with +20 on the following parameter __CALLBACKPARAM where you will need to change "NumberOfItems\":0 with +20 on each POST :)