奇妙な符号化big 5-hkscs
6121 ワード
# --*-- coding:utf-8 --*--
import urllib2
import urllib
postDict = {
'IsExist_Slt_Part_Id': 'False',
'IsExist_Slt_Stock_Id': 'False',
'current_page': '1',
'rdo_SelectSortBy': 'Shareholding',
'sel_ShareholdingDate_d': '12',
'sel_ShareholdingDate_m': '02',
'sel_ShareholdingDate_y': '2014',
'stock_market': 'HKEX',
'txt_ParticipantID': '',
'txt_Participant_name': '',
'txt_stock_code': '02088',
'txt_stock_name': '',
'txt_today_d': '4',
'txt_today_m': '5',
'txt_today_y': '2014'
}
postData = urllib.urlencode(postDict)
url = 'http://www.hkexnews.hk/sdw/search/search_sdw_c.asp'
req = urllib2.Request(url=url, data=postData)
req.add_header('User-Agent', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:27.0) Gecko/20100101 Firefox/27.0')
req.add_header('Content-Type', 'application/x-www-form-urlencoded')
res = urllib2.urlopen(req).read().decode('big5-hkscs')
print res