11

import urllib2
# from gzip import GzipFile
# from StringIO import StringIO
# def gzip(data):
#     buf = StringIO(data)
#     f = GzipFile(fileobj=buf)
#     return f.read()


url='http://bbs.cssn.cn/index.php?60171'
headers={
#'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0',
#'Accept-Encoding': 'gzip, deflate',
'Cookie': '2Sqh_2132_saltkey=T01NBQ48; 2Sqh_2132_ids_login_301=http%253A%252F%252Fbbs.cssn.cn%252Findex.php%253F60171; 2Sqh_2132_lastvisit=1481538392; 2Sqh_2132_sid=K1zTST; 2Sqh_2132_lastact=1481543815%09home.php%09misc; 2Sqh_2132_home_diymode=1; X-Mapping-kgaapcic=41C75F95FB88274C37DC7C7A6F15D428; 2Sqh_2132_ids_token=692F2090DC4FFA1897DC023B3DAE1A5A192.168.93.39; 2Sqh_2132_ids_token_type=com_trs_idm_gSessionId; CNZZDATA5791385=cnzz_eid%3D1089799930-1481536901-%26ntime%3D1481542849; wdcid=330595def0bb5c95; wdlast=1481462967; 2Sqh_2132_sendmail=1',

}
req = urllib2.Request(url,headers=headers)
a=urllib2.urlopen(req).read()
print a
#print gzip(a)

你可能感兴趣的:(11)