Peng Yu wrote:

> Hi,
> 
> Does anybody know how only get the redirected URL but not the actual
> content?
> 
> I guess the request module probably should be used. But I am not sure
> how to do it exactly.
> 
> Can somebody show me the best way to request
> (https://doi.org/10.1109/5.771073) and get the URL
> (http://ieeexplore.ieee.org/document/771073/)? Thanks.
> 

How about

>>> from urllib.request import urlopen
>>> urlopen("https://doi.org/10.1109/5.771073";).url
'http://ieeexplore.ieee.org:80/document/771073/?reload=true'

?

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to