2010-10-08 115 views

回答

3

你目前使用什麼?無論urlliburllib2應自動處理:

page = urllib.urlopen('http://mrozekma.com/302test.php') 
>>> print page.geturl() # This will show the redirected-to URL 
http://mrozekma.com/302test.php?success 
>>> print page.readlines() 
['Success'] 
0

如果您使用的是http.client.HTTPConnection(3.X),或httplib.HTTPConnection(2.X),剛剛獲得Location頭:

response.getheader('Location') 

我知道這個作品至少在craigslist.org上