Connecting Google News

dieter dieter at handshake.de
Mon Jul 17 00:40:50 EDT 2017


Javier Bezos <jbezos.dummy at gmail.com> writes:
> Google News used to fail with the high level functions provided by
> httplib and the like. However, I found this piece of code somewhere:
> ...
> A few days ago, Google News has been revamped and it doesn't work any
> more (2.6/Win7, 2.7/OSX and, with minimal changes, 3.6/Win7), because
> the page contents is empty. The code itself doesn't raise any
> errors. Which is the proper way to do it now? I must stick to the
> standard libraries.
>
> The returned headers are:
>
> ----------------------
>     [('Content-Type', 'application/binary'),
> ...
>      ('Location', 'https://news.google.com/news/?ned=es_mx&hl=es'),
> ...
>
> `status` is 302.

`status == 302` means a redirect; "Location" gives the new
url (to be redirected to).




More information about the Python-list mailing list