May-20-2018, 05:39 AM
(May-19-2018, 11:30 AM)snippsat Wrote:Thanks friend. I can't figure out what is happening in the script, but it is working flawlessly.(May-19-2018, 06:32 AM)apsaditya Wrote: But I don't know what string/integer should take the dots' placeThat's problem I din mention Chrome DevTools and Firefox Developer Tools. These can be used to look at what's going on when using a web-site. I you new to all this,you are not starting with an easy task. This loginMobile reset
is not a straight forward login. I can fill in rest,it may work or not(may need to parse cookie for your session) as mention it's not a straight forward login. Selenium as mention can be easier,but if not heard of any of this you starting in the wrong end.import requests headers = { 'Accept': 'application/json, text/javascript, */*; q=0.01', 'Accept-Language': 'nb-NO,nb;q=0.9,no-NO;q=0.8,no;q=0.6,nn-NO;q=0.5,nn;q=0.4,en-US;q=0.3,en;q=0.1', 'Connection': 'keep-alive', 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', 'Host': 'www.msmcampuscare.in', 'Referer': 'http://www.msmcampuscare.in/Logon/Logon', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0', 'X-Requested-With': 'XMLHttpRequest', } cookies = { 'ASP.NET_SessionId': 'j5qcmz1bduxsd5ot4slnybre', '__RequestVerificationToken': 'OJOQKxvKh_FtI6fmZuNNbI4zaJh3eh7uV1Odh_D_PrORGaPJv74iNQlzNTs9WEcV_zeGxic9B3OZ0WWVTYJyO-c291WoHh2-C7vr7yKZO2s1', 'chk': 'enable', } params = { "Mobile":"112234455", "Type":"2" } with requests.Session() as s: response = requests.post('http://www.msmcampuscare.in/Logon/ResetPassword', headers=headers, cookies=cookies, params=params ) print(response.text) # An authorised request. r = s.get('A protected web page url') print(r.text)