문제

cj=http.cookiejar.CookieJar()
opener=build_opener(HTTPCookieProcessor(cj))
data={'uid' : uid , 'password' : password }   #uid is username to the website
data=urllib.parse.urlencode(data)
data=data.encode(encoding='utf-8')
url='http://202.117.120.37/xdjwWebNew/Servlet/UsersControl' # url is a link to a specific page
request=Request(url,data)
response=opener.open(request)
response.geturl()

it output:

'http://docs.python.org/2/library/urllib2.html?highlight=urllib'

I don't what's the problem. Any advice will be helpful.

올바른 솔루션이 없습니다

다른 팁

What are you looking for it to output? If you want the html page at the link, use response.read(). Via the doc

This supports the following methods: read(), readline(), readlines()...
...these methods have the same interface as for file objects

The geturl() method returns the real URL of the page.
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top