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

Ben Bacarisse ben.usenet at bsb.me.uk
Sun Oct 15 16:06:02 EDT 2017


Irv Kalb <Irv at furrypants.com> writes:

>> On Oct 14, 2017, at 6:46 PM, Ben Bacarisse <ben.usenet at bsb.me.uk> 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's worth
>>>> noting.
>>> 
>>> That DID fix it.  I changed the URL to add 'download/' and it worked
>>> perfectly.
>> 
>> That's... interesting.
>> 
>>> Apparently, Python 3 differs from Python 2 in the way that it is
>>> handling a missing/forwarding URL, because the original code in Python
>>> 2.7 works perfectly.
>> 
>> Python 3 works for me.  I still suspect it's some system difference
>> rather than being, say, a 3.6.1 vs 3.5.2 difference.  What happens if
>> you change the URL to use https rather than http?
>> 
>
> Trying https (with and without the "download." part) results in the
> same traceback as I was seeing earlier.

It looks like there may be something amiss with your local certificates,
at least as far as Python's SSL code in concerned.  That's a Dark Art to
me so I can't really help (and it might be Mac specific).

The error might have showed up in the first test because the redirection
was to an https: URL.

-- 
Ben.



More information about the Python-list mailing list