37,720
社区成员
发帖
与我相关
我的任务
分享
#coding=utf-8
import urllib
import urllib2
import requests
import cookielib
import time
import socket
html='http://www.nlfang.com/info_list.asp'
post_data={'area_city': '%C4%CF%C1%EA%CF%D8&',
'late_class': '%B7%BF%CE%DD%B3%F6%CA%DB&',
'info_key': '%D6%D0%D1%EB'}
cook={'ASPSESSIONIDSQTTDCBB': 'DJIHGCDDJDDONFJDIGFIGCLC', 'Hm_lvt_b1214475eca64e9e15a8bf68ccb444e4': '1511423469', 'ad_play_index': '29', 'Hm_lpvt_b1214475eca64e9e15a8bf68ccb444e4': '1511423469', 'Hm_lvt_239f7aa51fc37d3b008907442ed09e64': '1511423468', 'Hm_lpvt_239f7aa51fc37d3b008907442ed09e64': '1511423468'}
header={'Accept': 'text/html, application/xhtml+xml, */*',
'Referer': 'http://www.nlfang.com/',
'Accept-Language': 'zh-CN',
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko',
'Content-Type': 'application/x-www-form-urle',
'Accept-Encoding': 'gzip, deflate',
'Host': 'www.nlfang.com',
'Content-Length': '86',
'Connection': 'Keep-Alive',
'Cache-Control': 'no-cache',
'Cookie': cook}
post_data=urllib.urlencode(post_data)
res=urllib2.Request(html,headers=header,data=post_data)
response=urllib2.urlopen(res)
print response
# coding=utf-8
import requests
html = 'http://www.nlfang.com/info_list.asp'
post_data = {'area_city': '%C4%CF%C1%EA%CF%D8&',
'late_class': '%B7%BF%CE%DD%B3%F6%CA%DB&',
'info_key': '%D6%D0%D1%EB'}
cook = {'ASPSESSIONIDSQTTDCBB': 'DJIHGCDDJDDONFJDIGFIGCLC', 'Hm_lvt_b1214475eca64e9e15a8bf68ccb444e4': '1511423469',
'ad_play_index': '29', 'Hm_lpvt_b1214475eca64e9e15a8bf68ccb444e4': '1511423469',
'Hm_lvt_239f7aa51fc37d3b008907442ed09e64': '1511423468',
'Hm_lpvt_239f7aa51fc37d3b008907442ed09e64': '1511423468'}
header = {'Accept': 'text/html, application/xhtml+xml, */*',
'Referer': 'http://www.nlfang.com/',
'Accept-Language': 'zh-CN',
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko',
'Content-Type': 'application/x-www-form-urle',
'Accept-Encoding': 'gzip, deflate',
'Host': 'www.nlfang.com',
'Content-Length': '86',
'Connection': 'Keep-Alive',
'Cache-Control': 'no-cache',
}
session = requests.session()
r = session.get(html, headers=header, data=post_data, cookies=cook)
print r.text
# coding=utf-8
import requests
html = 'http://www.nlfang.com/info_list.asp'
post_data = {'area_city': '%C4%CF%C1%EA%CF%D8&',
'late_class': '%B7%BF%CE%DD%B3%F6%CA%DB&',
'info_key': '%D6%D0%D1%EB'}
cook = {'ASPSESSIONIDSQTTDCBB': 'DJIHGCDDJDDONFJDIGFIGCLC', 'Hm_lvt_b1214475eca64e9e15a8bf68ccb444e4': '1511423469',
'ad_play_index': '29', 'Hm_lpvt_b1214475eca64e9e15a8bf68ccb444e4': '1511423469',
'Hm_lvt_239f7aa51fc37d3b008907442ed09e64': '1511423468',
'Hm_lpvt_239f7aa51fc37d3b008907442ed09e64': '1511423468'}
header = {'Accept': 'text/html, application/xhtml+xml, */*',
'Referer': 'http://www.nlfang.com/',
'Accept-Language': 'zh-CN',
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko',
'Content-Type': 'application/x-www-form-urle',
'Accept-Encoding': 'gzip, deflate',
'Host': 'www.nlfang.com',
'Content-Length': '86',
'Connection': 'Keep-Alive',
'Cache-Control': 'no-cache',
}
session = requests.session()
r = session.get(html, headers=header, data=post_data, cookies=cook)
print r.text