Actually, I am trying to collect some stock data from API. It returns a success response of 200 while using the browser. But once I tried to call via Postman or Python script, it returns 403 FORBIDDEN.
As per my understanding so far, this API doesn't require a token or authorization because you can call the API directly from the browser.
Here's the API Url:
https://idx.co.id/umbraco/Surface/TradingSummary/GetStockSummary?Length=3&date=20220714
Here's the website:
https://idx.co.id/data-pasar/ringkasan-perdagangan/ringkasan-saham/
I have tried several ways, but it doesn't solve my issue:
- I already put User-Agent & Accept.
- Put authorization, put token doesn't help.
- Curl this API also doesn't help much.
[postman]
[curl]
[python]
import requests
parameters = {
"Length": 2,
"date": 20220714
}
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36',
'accept-language': 'en-US,en;q=0.9'
}
base_url = "https://idx.co.id/umbraco/Surface/TradingSummary/GetStockSummary"
response = requests.get(url = base_url, params = parameters, headers = headers)
response