urllib error in Sage running on a Mac

asked 2017-06-03 03:22:29 +0200

markus gravatar image

I have used urllib in Sage for a while now (on Mac OS Yosemite). However, recently I've been getting an error: [Errno url error] unknown url type: 'https'

The code I'm using is getting exchange rates from Yahoo.

import urllib
def getRate(sym):
    url = 'http://finance.yahoo.com/d/quotes.csv?s=%s&f=%s' % (sym, 'l1c1va2xj1b4j4dyekjm3m4rr5p5p6s7')
    values = urllib.urlopen(url).read().strip().strip('"').split(',')
    return float(str(values[0]))

edit retag flag offensive close merge delete