#coding:utf-8
#!/usr/bin/python
import HTMLParser
import urlparse
import urllib
import urllib2
import cookielib
import string
import re
hosturl = *http://wapp.baidu.com/*
posturl = *http://wapp.baidu.com/*
cj = cookielib.LWPCookieJar()
cookie_support = urllib2.HTTPCookieProcessor(cj)
opener = urllib2.build_opener(cookie_support, urllib2.HTTPHandler)
urllib2.install_opener(opener)
h = urllib2.urlopen(hosturl)
headers = {*User-Agent* : *Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36*,
*Referer* : *http://wapp.baidu.com/*}
postData = {
*username* : *************,
*password* : **************
}
postData1 = urllib.urlencode(postData)
request = urllib2.Request(posturl, postData1, headers)
response = urllib2.urlopen(request)
text = response.read()
print text
求指导 求修改!!各位大神!@一颗幸福python @♂孤影幻月♀
#!/usr/bin/python
import HTMLParser
import urlparse
import urllib
import urllib2
import cookielib
import string
import re
hosturl = *http://wapp.baidu.com/*
posturl = *http://wapp.baidu.com/*
cj = cookielib.LWPCookieJar()
cookie_support = urllib2.HTTPCookieProcessor(cj)
opener = urllib2.build_opener(cookie_support, urllib2.HTTPHandler)
urllib2.install_opener(opener)
h = urllib2.urlopen(hosturl)
headers = {*User-Agent* : *Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36*,
*Referer* : *http://wapp.baidu.com/*}
postData = {
*username* : *************,
*password* : **************
}
postData1 = urllib.urlencode(postData)
request = urllib2.Request(posturl, postData1, headers)
response = urllib2.urlopen(request)
text = response.read()
print text
求指导 求修改!!各位大神!@一颗幸福python @♂孤影幻月♀
孤影幻月
