How to get the redirected URL only but not the actual content?

Peter Otten __peter__ at web.de
Sat Dec 2 05:49:49 EST 2017


Paul Moore wrote:

> On 2 December 2017 at 03:32, Peng Yu <pengyu.ut at gmail.com> wrote:
>> Where is `?reload=true` from? How to just get the redict URL that one
>> would get from the browser? Thanks.
>>
>>> 'http://ieeexplore.ieee.org:80/document/771073/?reload=true'
> 
> The reload=true comes because
> http://ieeexplore.ieee.org/document/771073/ is itself redirected to
> that location:
> 
>>curl -I http://ieeexplore.ieee.org/document/771073/
> HTTP/1.1 302 Moved Temporarily
> Date: Sat, 02 Dec 2017 10:25:58 GMT
> Location: http://ieeexplore.ieee.org:80/document/771073/?reload=true
> Set-Cookie:
> JSESSIONID=YewWwt7dRSRhQWpfvW_L_pCovlFPKnyDULFtYJGxwvaIvmv8-
RK-!-1840538570;
> path=/; HttpOnly;HttpOnly Set-Cookie: ERIGHTS=null;
> domain=ieeexplore.ieee.org; expires=Thu, 01-Jan-1970 01:00:00 GMT;
> path=/;HttpOnly Set-Cookie: ipCheck=109.154.64.43;
> domain=ieeexplore.ieee.org; path=/;HttpOnly Set-Cookie:
> ipCheck=109.154.64.43; domain=ieeexplore.ieee.org; path=/;HttpOnly
> Set-Cookie: cookieCheck=true; domain=ieeexplore.ieee.org; path=/;HttpOnly
> X-XSS-Protection: 1 Set-Cookie: WLSESSION=186802828.20480.0000;
> expires=Sun, 03-Dec-2017 10:25:58 GMT; path=/; Httponly
> Set-Cookie:
> 
TS011813a0=012f350623b6ced9dc5148879303ea57ba3f9321e686d26e43e83dddc173810cbaa92efa0046e79b1666b3f14f416143c59004edd9a10f9c23f67089ad348420304ac91dcfd756c69a4bbb7c0afe436aadb111a234;
> Path=/ Set-Cookie:
> 
TS01d430e1=012f3506230b0f867dbbdc2d8cd9812cc6cda6004b86d26e43e83dddc173810cbaa92efa00939a6282cc7ad5b9b80ddea276f6b5409df42e43a52ed561e1234df4ab341c2f3974c06b59548aab1e30a871ec4efc9bba1a756faf9076574ae4a4f67b57fa79856f016141e55bb9497d8dc4bbd4037c;
> path=/; domain=ieeexplore.ieee.org Transfer-Encoding: chunked

But why don't you see that in the browser? The server probably gives a user 
agent specific response. 

You may be able to "deceive" it with a library like mechanize (python2-
only).




More information about the Python-list mailing list