Relative Content

Tag Archive for pythonpython-3.xcookiespython-requests

Python Requests Authentication Issue: Setting cookies?

I am trying to scrape a Hertz Rental Car API (URL below) to get pricing options for a specific itinerary. This is not on the disallow list on their robots.txt. I captured the payload from my browser stemming from the initial Hertz (Hertz.com) page populating the trip details (location, dates, pickup times) that is submitted to the request URL below. When I then hit the API below with my payload, headers (token and user agent), cookies, and URL (copied from my network tab), I get a 200 response, but never get my anticipated response as I would expect to see based on what I see in my browser network tab when performing in my browser. I tried making my headers just my token and not having cookies, but that gave me an Incapsula issue. I believe this is a cookie issue based on the response below, and I think my method of taking my Hertz.com response to set my cookie is not working. Need guidance/help.

Python Requests Authentication Issue: Setting cookies?

I am trying to scrape a Hertz Rental Car API (URL below) to get pricing options for a specific itinerary. This is not on the disallow list on their robots.txt. I captured the payload from my browser stemming from the initial Hertz (Hertz.com) page populating the trip details (location, dates, pickup times) that is submitted to the request URL below. When I then hit the API below with my payload, headers (token and user agent), cookies, and URL (copied from my network tab), I get a 200 response, but never get my anticipated response as I would expect to see based on what I see in my browser network tab when performing in my browser. I tried making my headers just my token and not having cookies, but that gave me an Incapsula issue. I believe this is a cookie issue based on the response below, and I think my method of taking my Hertz.com response to set my cookie is not working. Need guidance/help.