I have this URL that works on Postman and returns data:
https://www.tablebuilder.singstat.gov.sg/api/table/resourceid?isTestApi=true&keyword=manufacturing&searchoption=all
But the Python code generated on Postman does not work.
import requests
url = "https://www.tablebuilder.singstat.gov.sg/api/table/resourceid?isTestApi=true&keyword=manufacturing&searchoption=all"
response = requests.request("GET", url)
print(response.text)
What could the reason be? This code used to work in the past. Is there a permanent fix for the problem?
You need to provide a User-Agent HTTP header.
For example: