Re: Retrieve final URL after redirection
- From: Daniel Drake <dsd laptop org>
- To: Dan Winship <danw gnome org>
- Cc: libsoup-list gnome org
- Subject: Re: Retrieve final URL after redirection
- Date: Sat, 7 Sep 2013 08:19:36 -0600
On Thu, Sep 5, 2013 at 7:24 PM, Dan Winship <danw gnome org> wrote:
The SoupMessage's URI gets updated when a redirect happens, so just call
soup_message_get_uri() (or read the "uri" property), and then use that
with soup_uri_new_with_base() to resolve the relative link.
from gi.repository import Soup
I tried that, and it doesn't seem to work.
session = Soup.SessionSync()
uri = Soup.URI.new("http://www.google.com")
m = Soup.Message(uri=uri)
session.send_message(m)
print m.get_uri().to_string(False)
print m.get_property('uri').to_string(False)
Output is
http://www.google.com/
http://www.google.com/
but google definitely redirects. Tested with libsoup-2.42.2
Daniel
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]