Re: Python 2 -> 3, urllib.urlopen (corrected the case)

2017-10-15 Thread Ben Bacarisse
Irv Kalb writes: >> On Oct 14, 2017, at 6:46 PM, Ben Bacarisse wrote: Finally, wget -S shows that the resource has moved. It is now at Location: http://download.finance.yahoo.com/d/quotes.csv?s=aapl&f=l1 I don't think this has anything to do with your problem, but it'

Re: Python 2 -> 3, urllib.urlopen (corrected the case)

2017-10-15 Thread Irv Kalb
> On Oct 14, 2017, at 6:46 PM, Ben Bacarisse wrote: > > Irv Kalb writes: > >> Thank you! > > You're welcome. > > >>> Just a data point... It works here: >>> >>> $ python3 t.py >>> Response is: b'156.99\n' >>> $ cat t.py >>> import urllib.request >>> fullURLWithParameters = 'http://financ

Re: Python 2 -> 3, urllib.urlopen (corrected the case)

2017-10-14 Thread Ben Bacarisse
Irv Kalb writes: > Thank you! You're welcome. >> Just a data point... It works here: >> >> $ python3 t.py >> Response is: b'156.99\n' >> $ cat t.py >> import urllib.request >> fullURLWithParameters = 'http://finance.yahoo.com/d/quotes.csv?s=aapl&f=l1' >> # read all the data >> response = ur

Re: Python 2 -> 3, urllib.urlopen (corrected the case)

2017-10-14 Thread Irv Kalb
Thank you! > On Oct 14, 2017, at 12:10 PM, Ben Bacarisse wrote: > > Irv Kalb writes: > > Lots of detail snipped. I hope it won't matter... > >> > (_ssl.c:749)> >> >> Huh??? >> >> I've read a bunch of documentation, and it looks like I'm doing >> everything right, but I cannot get this to w

Re: Python 2 -> 3, urllib.urlOpen

2017-10-14 Thread Mark Lawrence via Python-list
urllib.urlOpen to fetch data through an API. I am using an API that I found here:http://www.jarloo.com/yahoo_finance/ <http://www.jarloo.com/yahoo_finance/> As a minimal example, I am trying to get the latest stock price for Apple. The following example works perfectly in Python 2:

Re: Python 2 -> 3, urllib.urlopen (corrected the case)

2017-10-14 Thread Ben Bacarisse
Irv Kalb writes: Lots of detail snipped. I hope it won't matter... > (_ssl.c:749)> > > Huh??? > > I've read a bunch of documentation, and it looks like I'm doing > everything right, but I cannot get this to work. Any other > suggestions to get this 3 line program to work correctly? Just a da

Re: Python 2 -> 3, urllib.urlopen (corrected the case)

2017-10-14 Thread MRAB
fullURLWithParameters = 'http://finance.yahoo.com/d/quotes.csv?s=aapl&f=l1' # read all the data response = urllib.urlopen(fullURLWithParameters).read() print('Response is: ', response) I get the following: Traceback (most recent call last): File " s/StockQuo

Re: Python 2 -> 3, urllib.urlopen (corrected the case)

2017-10-14 Thread Irv Kalb
> fullURLWithParameters = 'http://finance.yahoo.com/d/quotes.csv?s=aapl&f=l1' > > # read all the data > response = urllib.urlopen(fullURLWithParameters).read() > > print('Response is: ', response) > > I get the following: > > Traceback (most

Re: Python 2 -> 3, urllib.urlOpen

2017-10-13 Thread MRAB
urllib.urlOpen to fetch data through an API. I am using an API that I found here:http://www.jarloo.com/yahoo_finance/ <http://www.jarloo.com/yahoo_finance/> As a minimal example, I am trying to get the latest stock price for Apple. The following example works perfectly in Python 2:

Re: Python 2 -> 3, urllib.urlOpen

2017-10-13 Thread Thomas Jollans
imports and uses urllib.urlOpen to fetch data through an API. I am > using an API that I found here:http://www.jarloo.com/yahoo_finance/ > <http://www.jarloo.com/yahoo_finance/> > Hi Irv, That's great! It's always nice to hear about more people moving with the t

Re: Python 2 -> 3, urllib.urlOpen

2017-10-13 Thread boB Stepp
On Fri, Oct 13, 2017 at 5:27 PM, Irv Kalb wrote: > I've looked at the Python 3.6 documentation for urllib, and I see that > certain calls have been changed and others have been eliminated. But my eyes > glaze over trying to figure out what to use instead. > > My question is: Is there a simple

Python 2 -> 3, urllib.urlOpen

2017-10-13 Thread Irv Kalb
One of the colleges where I teach has just moved from Python 2 to Python 3. I am in the process of converting my beginning Python class from Python 2 to Python 3. Everything has gone smoothly, until I just tried to convert some code that imports and uses urllib.urlOpen to fetch data through

Re: urllib.urlopen blocking?

2010-05-11 Thread Antoine Pitrou
On Tue, 11 May 2010 07:35:52 -0700 (PDT) Dominik Gabi wrote: > > For the record, have you tried calling gobject.threads_init() at the > > beginning of your application (just after importing all modules)? > > I haven't... now it works, thanks :) Any tips on how to avoid mistakes > like that in th

Re: urllib.urlopen blocking?

2010-05-11 Thread Dominik Gabi
> For the record, have you tried calling gobject.threads_init() at the > beginning of your application (just after importing all modules)? I haven't... now it works, thanks :) Any tips on how to avoid mistakes like that in the future? I'm somewhat confused as to how I was supposed to get this out

Re: urllib.urlopen blocking?

2010-05-11 Thread Antoine Pitrou
On Tue, 11 May 2010 06:22:29 -0700 (PDT) Dominik Gabi wrote: > > I'm new to python and have been playing around with it for a few days > now. So please forgive me if this is a stupid question :) > > I've tried writing a little application with pygtk and urllib. For the record, have you tried ca

urllib.urlopen blocking?

2010-05-11 Thread Dominik Gabi
thread is running but as soon as I call urllib.urlopen("https://someurl";, postdata) it blocks. It blocks until I do something in the interface (e.g. click another button). I've obviously missed something here. The interface should not interfere with anything that runs in an other thread!?

Re: Refreshing of urllib.urlopen()

2010-02-04 Thread Nobody
On Wed, 03 Feb 2010 21:33:08 -0600, Michael Gruenstaeudl wrote: > I am fairly new to Python and need advice on the urllib.urlopen() > function. The website I am trying to open automatically refreshes > after 5 seconds and remains stable thereafter. With > urllib.urlopen().read(

Re: Refreshing of urllib.urlopen()

2010-02-03 Thread Gabriel Genellina
En Thu, 04 Feb 2010 00:33:08 -0300, Michael Gruenstaeudl escribió: I am fairly new to Python and need advice on the urllib.urlopen() function. The website I am trying to open automatically refreshes after 5 seconds and remains stable thereafter. With urllib.urlopen().read() I can only

Re: Refreshing of urllib.urlopen()

2010-02-03 Thread Steve Holden
Michael Gruenstaeudl wrote: > Hi, > I am fairly new to Python and need advice on the urllib.urlopen() > function. The website I am trying to open automatically refreshes after > 5 seconds and remains stable thereafter. With urllib.urlopen().read() I > can only read the init

Refreshing of urllib.urlopen()

2010-02-03 Thread Michael Gruenstaeudl
Hi, I am fairly new to Python and need advice on the urllib.urlopen() function. The website I am trying to open automatically refreshes after 5 seconds and remains stable thereafter. With urllib.urlopen().read() I can only read the initial but not the refreshed page. How can I access the

Re: urllib.urlopen fails in Emacs

2008-09-26 Thread Niklas Norrthon
On 26 Sep, 12:21, Wojtek Walczak <[EMAIL PROTECTED]> wrote: > On Fri, 26 Sep 2008 02:23:18 -0600, Iain Dalton wrote: > > InEmacs, using run-python, > > >     import urllib > >    urllib.urlopen('http://www.google.com/') > > > results in this trac

Re: urllib.urlopen fails in Emacs

2008-09-26 Thread Wojtek Walczak
On Fri, 26 Sep 2008 02:23:18 -0600, Iain Dalton wrote: > In Emacs, using run-python, > > import urllib > urllib.urlopen('http://www.google.com/') > > results in this traceback: ... > IOError: [Errno socket error] (111, 'Connection refused') >

urllib.urlopen fails in Emacs

2008-09-26 Thread Iain Dalton
In Emacs, using run-python, import urllib urllib.urlopen('http://www.google.com/') results in this traceback: Traceback (most recent call last): File "", line 1, in File "/usr/lib/python2.5/urllib.py", line 82, in urlopen return ope

Re: How can i do proxy in urllib.urlopen?

2007-10-27 Thread Abandoned
I read the urllib reference and set http_proxy="my proxy". But it didn't work. I can't even get authenticated. Is there anyway that we can set the proxy? -- http://mail.python.org/mailman/listinfo/python-list

How can i do proxy in urllib.urlopen?

2007-10-27 Thread Abandoned
Hi i want to do proxy in urllib.urlopen how can i do this ? And which proxy type have i can prefer ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Entering username & password automatically using urllib.urlopen

2007-10-14 Thread James Matthews
if you want to hardcode the password in the url. What you need to do is http:username:[EMAIL PROTECTED] On 10/14/07, Diez B. Roggisch <[EMAIL PROTECTED]> wrote: > > rodrigo schrieb: > > I am trying to retrieve a password protected page using: > > > &

RE: Entering username & password automatically using urllib.urlopen

2007-10-14 Thread Ryan Ginstrom
> On Behalf Of rodrigo > I am trying to retrieve a password protected page using: > > get = urllib.urlopen('http://password.protected.url";').read() I would suggest looking at mechanize. http://wwwsearch.sourceforge.net/mechanize/ from mechanize import Browser

Re: Entering username & password automatically using urllib.urlopen

2007-10-14 Thread Daniel Larsson
You form the URL thus: http://:@:/ This is defined in RFC 1738 <http://www.faqs.org/rfcs/rfc1738.html> On 10/14/07, rodrigo <[EMAIL PROTECTED]> wrote: > > I am trying to retrieve a password protected page using: > > get = urllib.urlopen('http://password.protected.u

Re: Entering username & password automatically using urllib.urlopen

2007-10-14 Thread byte8bits
On Oct 13, 11:41 pm, rodrigo <[EMAIL PROTECTED]> wrote: > I am trying to retrieve a password protected page using: > > get = urllib.urlopen('http://password.protected.url";').read() > > While doing this interactively, I'm asked for the username, then the &

Re: Entering username & password automatically using urllib.urlopen

2007-10-14 Thread Diez B. Roggisch
rodrigo schrieb: > I am trying to retrieve a password protected page using: > > get = urllib.urlopen('http://password.protected.url";').read() > > While doing this interactively, I'm asked for the username, then the > password at the terminal. > Is there

Entering username & password automatically using urllib.urlopen

2007-10-14 Thread rodrigo
I am trying to retrieve a password protected page using: get = urllib.urlopen('http://password.protected.url";').read() While doing this interactively, I'm asked for the username, then the password at the terminal. Is there any way to do this non-interactively? To hardcode

Re: Inconsistent result from urllib.urlopen

2007-04-13 Thread junkdump2861
Laszlo Nagy wrote: > > Any ideas why I don't get the same result from the python script as I > > do from a web browser? This problem seems to be a recent > > development. The scripts I wrote like this worked fine for a while > > and then stopped working within the past couple of weeks. > > > May

Re: Inconsistent result from urllib.urlopen

2007-04-12 Thread Facundo Batista
[EMAIL PROTECTED] wrote: > import urllib > f = urllib.urlopen('http://en.wikipedia.org/wiki/Cain') > data = f.read(999) > f.close() > f1 = open('junk.txt', 'w') > f1.write(data) > f1.close() Did you see the file "junk.txt"? I

Re: Inconsistent result from urllib.urlopen

2007-04-12 Thread Gabriel Genellina
En Thu, 12 Apr 2007 15:25:03 -0300, <[EMAIL PROTECTED]> escribió: > Any ideas why I don't get the same result from the python script as I > do from a web browser? This problem seems to be a recent > development. The scripts I wrote like this worked fine for a while > and then stopped working wit

Re: Inconsistent result from urllib.urlopen

2007-04-12 Thread Laszlo Nagy
> Any ideas why I don't get the same result from the python script as I > do from a web browser? This problem seems to be a recent > development. The scripts I wrote like this worked fine for a while > and then stopped working within the past couple of weeks. > Maybe it has to do something wi

Inconsistent result from urllib.urlopen

2007-04-12 Thread junkdump2861
not getting it. Instead, I get a file only 21 kb that has no image addresses. Here's the code I use: import urllib f = urllib.urlopen('http://en.wikipedia.org/wiki/Cain') data = f.read(999) f.close() f1 = open('junk.txt', 'w') f1.write(data) f1.close() Any ide

Re: problem with my urllib.urlopen() function

2007-04-04 Thread Gabriel Genellina
En Thu, 05 Apr 2007 02:40:38 -0300, Xell Zhang <[EMAIL PROTECTED]> escribió: > hello all, > I am a newbie in Python. > In my module, if I call urllib.urlopen() function like: > url = "http://www.google.com/"; > source = urllib.urlopen(url) > > Then in

problem with my urllib.urlopen() function

2007-04-04 Thread Xell Zhang
hello all, I am a newbie in Python. In my module, if I call urllib.urlopen() function like: url = "http://www.google.com/"; source = urllib.urlopen(url) Then in the output there will be an exception: Exception exceptions.AttributeError: "'NoneType' object has no

Re: urllib.urlopen unwanted password prompts - documentation problem

2006-12-27 Thread John J. Lee
John Nagle <[EMAIL PROTECTED]> writes: >If you try to open a password protected page with "urllib.urlopen()", you > get > > "Enter username for EnterPassword at example.com:" > > on standard output, followed by a read for input! This see

urllib.urlopen unwanted password prompts - documentation problem

2006-12-27 Thread John Nagle
If you try to open a password protected page with "urllib.urlopen()", you get "Enter username for EnterPassword at example.com:" on standard output, followed by a read for input! This seems to be an undocumented feature, if not a bug. Definitely the docum

Re: urllib.urlopen: Errno socket error

2006-11-09 Thread frifri007
[EMAIL PROTECTED] a écrit : > Hi, > > I'm just trying to read from a webpage with urllib but I'm getting > IOErrors. This is my code: > > import urllib > sock = urllib.urlopen("http://www.google.com/";) > > and this is the error: > > Trace

Re: urllib.urlopen: Errno socket error

2006-10-17 Thread kgrafals
Dennis, I tried a ProxyHandler with the following code ... proxy_support = urllib2.ProxyHandler({}) opener = urllib2.build_opener(proxy_support) urllib2.install_opener(opener) ... but it's giving me the same result. Then I tried to tunnel using code from ... http://aspn.activestate.com/ASPN/Co

Re: urllib.urlopen: Errno socket error

2006-10-16 Thread kgrafals
Hi Salvatore, Even if I catch the exceptions in a loop it goes on forever. - ken -- http://mail.python.org/mailman/listinfo/python-list

Re: urllib.urlopen: Errno socket error

2006-10-16 Thread Salvatore
Hello, Try to increase the time out : socket.settimeout(n) and catch the timeout error when it occurs Regards [EMAIL PROTECTED] a écrit : > Hi, > > I'm just trying to read from a webpage with urllib but I'm getting > IOErrors. This is my code: > > import urllib &

urllib.urlopen: Errno socket error

2006-10-16 Thread kgrafals
Hi, I'm just trying to read from a webpage with urllib but I'm getting IOErrors. This is my code: import urllib sock = urllib.urlopen("http://www.google.com/";) and this is the error: Traceback (most recent call last): File "", line 1, in sock = urllib.

Re: urllib.urlopen() with pages that requires cookies.

2006-04-29 Thread John J. Lee
"mwt" <[EMAIL PROTECTED]> writes: > Fredrik Lundh wrote: [...] > > use urllib2 and cookielib. here's an outline: > > > > import urllib2, cookielib > > > > # set things up > > jar = cookielib.CookieJar() > > handler = urllib2.HTTPCookieProcessor(jar) > > opener = urllib2.build_

Re: urllib.urlopen() with pages that requires cookies.

2006-04-27 Thread mwt
Fredrik Lundh wrote: > Øyvind Østlund wrote: > > > I am trying to visit a limited amount of web pages that requires cookies. I > > will get redirected if my application does not handle them. I am using > > urllib.urlopen() to visit the pages right now. And I need a push in

Re: urllib.urlopen() with pages that requires cookies.

2006-04-27 Thread Fredrik Lundh
Øyvind Østlund wrote: > I am trying to visit a limited amount of web pages that requires cookies. I > will get redirected if my application does not handle them. I am using > urllib.urlopen() to visit the pages right now. And I need a push in the > right direction to find out how

urllib.urlopen() with pages that requires cookies.

2006-04-27 Thread Øyvind Østlund
I am trying to visit a limited amount of web pages that requires cookies. I will get redirected if my application does not handle them. I am using urllib.urlopen() to visit the pages right now. And I need a push in the right direction to find out how to deal with pages that requires cookies

Re: urllib.urlopen and https question

2006-01-10 Thread doobiz
Does anyone have an entire (simple) script for someone new to programming and Python that will illustrate how to open an https site and log on to it (with the script providing the username and password, if that's possible). Thanks very much. rpd "Electricity is actually made up of extremely tiny

Re: urllib.urlopen and https question

2006-01-10 Thread bowman . joseph
That's what I get for scimming the documentation too quickly. Got it, thanks! For anyone else working on something similar, here is all I did... mind you, this is my first experience with python. # subclass of FancyURLopener so we can override the prompt_user_password method class DBCheckUrlOpen

Re: urllib.urlopen and https question

2006-01-10 Thread [EMAIL PROTECTED]
>From the docs for urllib: When performing basic authentication, a FancyURLopener instance calls its prompt_user_passwd() method. The default implementation asks the users for the required information on the controlling terminal. A subclass may override this method to support more appropriate beha

urllib.urlopen and https question

2006-01-10 Thread bowman . joseph
Hi, I'm new to python. I've been handed the job of modifying a script we have here at work that pulls content from a zope site, to create static html. They wanted a check to make sure the database is up, while pulling, to avoid errors. I got it pretty much working how I want without any problems.

Re: urllib.urlopen

2005-12-18 Thread Tom Anderson
On Sat, 17 Dec 2005, Dennis Lee Bieber wrote: > (Now there is an interesting technical term: > #define ERROR_ARENA_TRASHED 7) FreeBSD at one point had an EDOOFUS; Apple kvetched about this being offensive, so it was changed to EDONTPANIC. I shitteth thee not. tom -- information distribut

Re: urllib.urlopen

2005-12-18 Thread JabaPyth
Thanks, guys. I tried on a different computer, and it worked fine.I then found out that my computer thyought i had a proxy server, and after i cleaned that up, it worked. Thanks again -- http://mail.python.org/mailman/listinfo/python-list

Re: urllib.urlopen

2005-12-18 Thread gene tani
Jay wrote: > Easy Fix... > > import urllib > the_url = "http://www.google.com"; > req = urllib.urlopen(the_url) > > Does this work for you?? This does look like proxie /firewall issue, try it from an internet cafe. Also depending on the site, you may have t

Re: urllib.urlopen

2005-12-17 Thread Jay
Easy Fix... import urllib the_url = "http://www.google.com"; req = urllib.urlopen(the_url) Does this work for you?? -- http://mail.python.org/mailman/listinfo/python-list

Re: urllib.urlopen

2005-12-17 Thread JabaPyth
I tried using urllib2 and this is what i got: >>import urllib2 >>the_url = 'http://www.google.com' >>req = urllib2.Request(the_url) >>handle = urllib2.urlopen(req) Traceback (most recent call last): File "", line 1, in ? File "C:\Python24\lib\urllib2.py", line 130, in urlopen return _opener

Re: urllib.urlopen

2005-12-17 Thread Xavier Morel
JabaPyth wrote: > Hello, > I'm trying to use the urllib module, but when i try urllib.urlopen, it > gives me a socket error: > > >>import urllib > >>print urllib.urlopen('http://www.google.com/').read() > Traceback (most recent call last

urllib.urlopen

2005-12-17 Thread JabaPyth
Hello, I'm trying to use the urllib module, but when i try urllib.urlopen, it gives me a socket error: >>import urllib >>print urllib.urlopen('http://www.google.com/').read() Traceback (most recent call last): File "", line 1, in ?

Re: urllib.urlopen doesn't work

2005-09-02 Thread Steve Holden
Josef Cihal wrote: > Hallo, > > i need a help with module URLLIB. > > I am trying to open url via: > -urllib.urlopen > ('http://brokerjet.ecetra.com/at/markets/stocks/indices.phtml?notation=92866') > > > Problem is, that I am always redirecting t

Fw: urllib.urlopen doesn't work

2005-09-02 Thread Josef Cihal
  - Original Message - From: Josef Cihal To: python-list@python.org Sent: Saturday, September 03, 2005 12:09 AM Subject: urllib.urlopen doesn't work Hallo,   i need a help with module URLLIB.   I am trying to open url via: -    urllib.urlopen ('http://brokerjet.ece

urllib.urlopen doesn't work

2005-09-02 Thread Josef Cihal
Hallo,   i need a help with module URLLIB.   I am trying to open url via: -    urllib.urlopen ('http://brokerjet.ecetra.com/at/markets/stocks/indices.phtml?notation=92866')     Problem is, that I am always redirecting to - LOGIN page (www.brokerjet.at), and cannot get my page

urllib2.urlopen hangs, urllib.urlopen works?

2005-07-10 Thread Chris
hello, I have an odd behaviour. I try to download some files connected to a specific webpage (e.g. all stylesheets) with urllib2.urlopen(x) This seems to hang on the 2nd file or so. Doing the exact same thing via urllib.urlopen(x) does work without a hitch... I don't real