The following code gets an outdated response from API:
“` import requests
response = requests.get(“https://foo.com/api/json-example”) “`
However the below command gets the correct response:
curl https://foo.com/api/json-example
What can be the possible reasons for this? And how to get requests
to get the same response as curl
. I asked chatgpt and it suggests adding no-cache headers but that didn’t help my case.
submitted by /u/iaseth
[link] [comments]
r/learnpython The following code gets an outdated response from API: “` import requests response = requests.get(“https://foo.com/api/json-example”) “` However the below command gets the correct response: curl https://foo.com/api/json-example What can be the possible reasons for this? And how to get requests to get the same response as curl. I asked chatgpt and it suggests adding no-cache headers but that didn’t help my case. submitted by /u/iaseth [link] [comments]
The following code gets an outdated response from API:
“` import requests
response = requests.get(“https://foo.com/api/json-example”) “`
However the below command gets the correct response:
curl https://foo.com/api/json-example
What can be the possible reasons for this? And how to get requests
to get the same response as curl
. I asked chatgpt and it suggests adding no-cache headers but that didn’t help my case.
submitted by /u/iaseth
[link] [comments]