data = {‘doSearch’: “Search”
}
user_agent = ‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.3 Safari/605.1.1’
cookies = {
‘ArtId’: ‘*************’
}
headers = {
‘User-Agent’: user_agent,
‘Cache-Control’: ‘no-cache, no-store, must-revalidate’,
‘Pragma’: ‘no-cache’,
‘Expires’: ‘0’
}
def get_classes(src, dest):
unique_identifier = int(time.time()) # Unique timestamp
query = f'{src}+{dest}&ts={unique_identifier}' # Append to make request unique
url = f'https://njtransfer.org/artweb/listeqs.cgi?{query}'
print(query)
r = requests.post(url, data=data, headers=headers, cookies=cookies)
return r.text
When I make a call to getclasses, I get the same response as one of the previous calls I made to getclasses function. For example, https://njtransfer.org/artweb/listeqs.cgi?AT+BS would have the same response as https://njtransfer.org/artweb/listeqs.cgi?OC+EN. All subsequent requests are a copy of one of the previous requests. I am not sure if this a caching issue. I added a header to prevent caching and a unique identifier just in case, but it doesn’t fix issue.
I am expecting a different response for each different combination of parameters in the url post request. Instead I am getting the same one. Yet when I enter the different urls in the browser, I am getting different responses unlike my program.
fisheyeloki5355 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.