Python Forum
POST requests - different requests return the same response
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
POST requests - different requests return the same response
#1
Hi All,

I'm trying to retrieve data from a site by sending a POST request which appears to work, however, it returns the same result despite the request changing.

For example:
1. if I change the dates
2. submit the request
3. it will still return the same result as if I never changed the dates

I check this via the website manually incase it case the data was in fact the same and found the data was different so something is must be wrong with my request.

Any help would be greatly appreciated! I'm stuck with this.
Bdate = 20210220
Adate = 20220220   

#Prepare the column headers
BdateVal = str(Bdate) + " Est. value ($m)"
AdateVal = str(Adate) + " Est. value ($m)"

#retrive payload and enter index + dates
d =  {"__EVENTTARGET":"m$m$p1$p1$ITrakResults$DownloadButtoniTrak",
      "__EVENTARGUMENT":"",
      "__LASTFOCUS":"",
      "__VIEWSTATE":VS,
      "__VIEWSTATEGENERATOR":VSG ,
      "__SCROLLPOSITIONX":0,
      "__SCROLLPOSITIONY":0,
      "m$m$p1$p1$ITrakFilter$ddlInvestmentIn":352,
      "m$m$p1$p1$ITrakFilter$ddlComparisonPeriod":Bdate,
      "m$m$p1$p1$ITrakFilter$HiddenFieldLatterDate":Adate,
      "m$m$p1$p1$ITrakFilter$txtInvestorName":"",
      "m$m$p1$p1$ITrakFilter$ddlInvestmentStyle":"",
      "m$m$p1$p1$ITrakFilter$ddlInvestorList":"All Company Lists",
      "m$m$p1$p1$ITrakFilter$ddlInvestmentTrends":0,
      "m$m$p1$p1$ITrakFilter$slider_min":0,
      "m$m$p1$p1$ITrakFilter$slider_max":71000,
      "m$m$p1$p1$ITrakFilter$txtSliderLeftValue":0,
      "m$m$p1$p1$ITrakFilter$txtSliderRightValue":71000,
      "m$m$p1$p1$ITrakFilter$ucLocation$Location":"RadioButtonLocationIgnore",
      "m$m$p1$p1$ITrakFilter$ucLocation$DropDownRegions":0,
      "m$m$p1$p1$ITrakFilter$ucLocation$DropDownCountries":0}

params = {"InvIn":352,
          "FormerDateID":Bdate,
          "Holders":0,
          "ShowDetail":"True",
          "InvName":"",
          "sort":"LatterEstMarketSegmentValue",
          "sortAsc":"False"}
   
#Post request
GetCSV = s.post("https://secure.somewebsite.com/iTrak/Default.aspx?",params=params, headers=DownloadHeaders, data=d)
Snippet of Chrome Dev tool to view the payload with the request: https://ibb.co/yShrqdx

Attached Files

Thumbnail(s)
   
Reply
#2
what package are you working with?
code cannot be run as posted.
Reply
#3
(Mar-10-2022, 10:07 AM)Larz60+ Wrote: what package are you working with?
code cannot be run as posted.

Sorry missed that detail! I'm working with requests, where s = requests.session().

The website is https://secure.miraqle.com/Login?ReturnUrl=%2f which requires a username + pw which I can't share and it costs to sign up.

However I can provide any other information as necessary.

Really appreciate the help
Reply
#4
Solved it! I needed to the post request to be in the same kernel as the With requests.session():
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Async for making requests DangDuong 3 1,068 Mar-04-2024, 03:50 AM
Last Post: sarahlly
  Getting a URL from Amazon using requests-html, or beautifulsoup aaander 1 1,678 Nov-06-2022, 10:59 PM
Last Post: snippsat
Question requests.get miss format the conecction url jlcc_py 2 1,833 Jul-19-2022, 04:00 AM
Last Post: unawareenormousy
  requests-html + Beautifulsoup klaarnou 0 2,449 Mar-21-2022, 05:31 PM
Last Post: klaarnou
  Send a requests to a magnet links shortener which doesn't have APIs Ascalon 3 2,194 Feb-20-2022, 04:50 PM
Last Post: snippsat
  How to get filtered result using payload in requests? Moto 5 2,052 Feb-14-2022, 11:46 AM
Last Post: Moto
  Processing "I am not a spammer" with requests rhubarbpieguy 1 1,693 Jan-18-2022, 06:37 PM
Last Post: snippsat
  requests.post() does work Alto 1 2,025 Aug-13-2021, 07:58 AM
Last Post: ndc85430
  passing token to requests alejandroot 4 3,143 Mar-12-2021, 04:49 PM
Last Post: alejandroot
  Requests module get() incomplete download bobzarm 2 2,542 Feb-17-2021, 04:51 PM
Last Post: bobzarm

Forum Jump:

User Panel Messages

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