Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #85745 > unrolled thread

URL - Python ?

Started byJosef Achkar <josef.achkar@gmail.com>
First post2015-02-17 08:38 -0800
Last post2015-02-17 17:45 +0100
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  URL - Python ? Josef Achkar <josef.achkar@gmail.com> - 2015-02-17 08:38 -0800
    Re: URL - Python ? Emil Oppeln-Bronikowski <emil@fuse.pl> - 2015-02-17 17:45 +0100

#85745 — URL - Python ?

FromJosef Achkar <josef.achkar@gmail.com>
Date2015-02-17 08:38 -0800
SubjectURL - Python ?
Message-ID<0ee84d3b-0223-4c0b-a089-1722504ed7bc@googlegroups.com>
Hi i was wondering if it's possible to trace a website.
If im for example is interested of the content of www.example.com/cars/audi
and i have noticed that they are changing all URL's on the site so it dosent change at all and that it always stays the same like for example www.example.com and that i want to still be able to visit the page using "www.example.com/cars/audi"

I would want to know if it's possible to trace the url to the new location 

[toc] | [next] | [standalone]


#85747

FromEmil Oppeln-Bronikowski <emil@fuse.pl>
Date2015-02-17 17:45 +0100
Message-ID<mailman.18790.1424193116.18130.python-list@python.org>
In reply to#85745

[Multipart message — attachments visible in raw view] — view raw

> I would want to know if it's possible to trace the url to the new location

If the webmaster did a proper thing you'll get server 3xx HTTP header 
that will point you to new URL.

http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_Redirection

If you're using a good library to do your HTTP (like requests) the 
URL-following is build in and free

>>>r  =  requests.get('http://github.com')
>>>r.url
'https://github.com/'
>>>r.status_code
200
>>>r.history
[<Response [301]>]

If you want to track changes just check if response.history has some items in it.

-- 

Emil Oppeln-Bronikowski *|* http://fuse.pl

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web