[Tutor] issues with urllib and loading a webpage.

Sander Sweers sander.sweers at gmail.com
Tue Aug 23 21:57:28 CEST 2011


On 23/08/11 21:27, Robert Sjoblom wrote:
> Here's the code I'm working with:
> from http.client import HTTPConnection
> HTTPConnection.debuglevel = 1
> from urllib.request import urlopen
>
> url = "http://www.boursorama.com/includes/cours/last_transactions.phtml?symbole=1xEURUS"
> response = urlopen(url)
> print(response.headers.as_string())
> print(type(response))
<snip>
> Now, if I were to do a data = response.read() and then print(data), I
> should get the source code printed (testing this on python.org works,
> btw). However, what I do get is:
> b''
>
> What gives?

Don't know, works fine for me..

Greets
Sander


More information about the Tutor mailing list