Re: [Tutor] Retrieving data from a web site

2013-05-20 Thread Phil
On 20/05/13 17:55, Peter Otten wrote: I've rerun the script and it still works over here. I'm in Germany, though, and therefore there's a small chance that I'm being served different data. What does import urllib2 Thank you Peter for your detailed reply, I now have a better understanding of

Re: [Tutor] Retrieving data from a web site

2013-05-19 Thread Phil
On 19/05/13 18:05, Peter Otten wrote: The original Python 2 code: $ cat parse.py import urllib2 import json url = "http://*/goldencasket"; s = urllib2.urlopen(url).read() s = s.partition("latestResults_productResults")[2].lstrip(" =") s = s.partition(";")[0] data = json.loads(s) lot

Re: [Tutor] Retrieving data from a web site

2013-05-19 Thread Phil
On 19/05/13 21:46, Dave Angel wrote: Have you simply tried using urlib.request ? That should be built into Python 3.3 without any outside packages from Kubuntu. (I haven't used Kubuntu, just making some bald assumptions) Thanks Dave, Thanks Dave, The urllib.request package has the same depe

Re: [Tutor] Retrieving data from a web site

2013-05-19 Thread Dave Angel
On 05/19/2013 07:30 AM, Phil wrote: On 19/05/13 18:05, Peter Otten wrote: Phil wrote: My apatite having been whetted I'm now stymied because of a Ubuntu dependency problem during the installation of urllib3. This is listed as a bug. Has anyone overcome this problem? Perhaps there's another li

Re: [Tutor] Retrieving data from a web site

2013-05-19 Thread Phil
On 19/05/13 18:05, Peter Otten wrote: Phil wrote: My apatite having been whetted I'm now stymied because of a Ubuntu dependency problem during the installation of urllib3. This is listed as a bug. Has anyone overcome this problem? Perhaps there's another library that I can use to download data

Re: [Tutor] Retrieving data from a web site

2013-05-19 Thread Peter Otten
Phil wrote: > My apatite having been whetted I'm now stymied because of a Ubuntu > dependency problem during the installation of urllib3. This is listed as > a bug. Has anyone overcome this problem? > > Perhaps there's another library that I can use to download data from a > web page? You mean y

Re: [Tutor] Retrieving data from a web site

2013-05-18 Thread Phil
My apatite having been whetted I'm now stymied because of a Ubuntu dependency problem during the installation of urllib3. This is listed as a bug. Has anyone overcome this problem? Perhaps there's another library that I can use to download data from a web page? -- Regards, Phil _

Re: [Tutor] Retrieving data from a web site

2013-05-18 Thread Phil
On 18/05/13 22:44, Peter Otten wrote: You can use a tool like lxml that "understands" html (though in this case you'd need a javascript parser on top of that) -- or hack something together with string methods or regular expressions. For example: import urllib2 import json s = urllib2.urlopen("h

Re: [Tutor] Retrieving data from a web site

2013-05-18 Thread Walter Prins
Hi Just a minor observation: On 18 May 2013 13:44, Peter Otten <__pete...@web.de> wrote: > Phil wrote: > > > On 18/05/13 19:25, Peter Otten wrote: > >> > >> Are there alternatives that give the number as plain text? > > > > Further investigation shows that the numbers are available if I view the

Re: [Tutor] Retrieving data from a web site

2013-05-18 Thread Peter Otten
Phil wrote: > On 18/05/13 19:25, Peter Otten wrote: >> >> Are there alternatives that give the number as plain text? > > Further investigation shows that the numbers are available if I view the > source of the page. So, all I have to do is parse the page and extract > the drawn numbers. I'm not s

Re: [Tutor] Retrieving data from a web site

2013-05-18 Thread Phil
On 18/05/13 19:25, Peter Otten wrote: Are there alternatives that give the number as plain text? Further investigation shows that the numbers are available if I view the source of the page. So, all I have to do is parse the page and extract the drawn numbers. I'm not sure, at the moment, how

Re: [Tutor] Retrieving data from a web site

2013-05-18 Thread Phil
On 18/05/13 19:25, Peter Otten wrote: What's the url of the page? http://tatts.com/goldencasket Are there alternatives that give the number as plain text? Not that I can find. A Google search hasn't turned up anything. If not, do the images have names like whatever0.jpg, whatever1.jpg, w

Re: [Tutor] Retrieving data from a web site

2013-05-18 Thread Peter Otten
Phil wrote: > On 18/05/13 16:33, Alan Gauld wrote: >> On 18/05/13 00:57, Phil wrote: >>> I'd like to "download" eight digits from a web site where the digits are >>> stored as individual graphics. Is this possible, using perhaps, one of >>> the countless number of Python modules? Is this the funct

Re: [Tutor] Retrieving data from a web site

2013-05-18 Thread Phil
On 18/05/13 16:33, Alan Gauld wrote: On 18/05/13 00:57, Phil wrote: I'd like to "download" eight digits from a web site where the digits are stored as individual graphics. Is this possible, using perhaps, one of the countless number of Python modules? Is this the function of a web scraper? In

Re: [Tutor] Retrieving data from a web site

2013-05-17 Thread Alan Gauld
On 18/05/13 00:57, Phil wrote: I'd like to "download" eight digits from a web site where the digits are stored as individual graphics. Is this possible, using perhaps, one of the countless number of Python modules? Is this the function of a web scraper? In addition to Dave's points there is als

Re: [Tutor] Retrieving data from a web site

2013-05-17 Thread Dave Angel
On 05/17/2013 07:57 PM, Phil wrote: I'd like to "download" eight digits from a web site where the digits are stored as individual graphics. Is this possible, using perhaps, one of the countless number of Python modules? Is this the function of a web scraper? Anything's possible. But if these

[Tutor] Retrieving data from a web site

2013-05-17 Thread Phil
I'd like to "download" eight digits from a web site where the digits are stored as individual graphics. Is this possible, using perhaps, one of the countless number of Python modules? Is this the function of a web scraper? -- Regards, Phil ___ Tutor