L
lalbadelmondo
Guest
lalbadelmondo Asks: Python requests still having error 403 forbidden on this particular website
I want to scrap list of stock symbols from Indonesian stock exchange website. But I'm still having 403 error despite already tried to modify requests' headers (which is suggested by many people out there).
I don't have expertise in web admin security stuff, so what I want to ask, is this task still doable or it's a dead end due to some kind of protection on the server side? Below are my codes. Thanks.
I want to scrap list of stock symbols from Indonesian stock exchange website. But I'm still having 403 error despite already tried to modify requests' headers (which is suggested by many people out there).
I don't have expertise in web admin security stuff, so what I want to ask, is this task still doable or it's a dead end due to some kind of protection on the server side? Below are my codes. Thanks.
Code:
import requests
url = 'https://www.idx.co.id/data-pasar/data-saham/daftar-saham/'
hdr = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
'Accept-Encoding': 'none',
'Accept-Language': 'en-US,en;q=0.8',
'Connection': 'keep-alive'}
session = requests.Session()
response = session.get(url, headers=hdr)
print(response.status_code)
SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, solveforum.