Python Forum
A crazy project involving webpage interaction
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A crazy project involving webpage interaction
#8
(May-19-2018, 11:30 AM)snippsat Wrote:
(May-19-2018, 06:32 AM)apsaditya Wrote: But I don't know what string/integer should take the dots' place
That's problem Wink 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 login Mobile 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)
Thanks friend. I can't figure out what is happening in the script, but it is working flawlessly.
Reply


Messages In This Thread
RE: A crazy project involving webpage interaction - by apsaditya - May-20-2018, 05:39 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Best framework for MySQL interaction and Tensorflow / TFLite inference? f_set89 0 565 Nov-23-2023, 04:14 PM
Last Post: f_set89
  this would be silly if it as not driving mr crazy Blue Dog 16 12,853 Oct-27-2016, 10:21 PM
Last Post: Blue Dog

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020