lundi 21 mai 2018

How to scrap data from aspx page

Hi how to scrap aspx web with python i am trying to get data from

http://www.scstrade.com/stockscreening/SS_CompanySnapShotAnn.aspx?symbol=UBL%20-%20United%20Bank%20Ltd.

i used following code but result did not include table which i want.

import urllib.parse
import urllib.request
url = 'http://www.scstrade.com'
values = {'q' : 'SS_CompanySnapShotAnn.aspx?symbol=PIF%20- 
%20PICIC%20Investment%20Fund'}
data = urllib.parse.urlencode(values)
data = data.encode('utf-8') # data should be bytes
headers = {}
headers['User-Agent'] = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 
(KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17"
req = urllib.request.Request(url,data, headers = headers)
resp = urllib.request.urlopen(req)
respData = resp.read()

print(respData) 




Aucun commentaire:

Enregistrer un commentaire