Sharedsupport / 2018-05-22-091519.ipynbOpen in CoCalc
Author: William A. Stein
License: GNU General Public License v3.0
Description: Examples for support purposes.
In [2]:
finance.Stock('vmw').close(startdate='Jan+1,+2008', enddate='Feb+1,+2008')
--------------------------------------------------------------------------- HTTPError Traceback (most recent call last) <ipython-input-2-1989dd625f84> in <module>() ----> 1 finance.Stock('vmw').close(startdate='Jan+1,+2008', enddate='Feb+1,+2008') /ext/sage/sage-8.1/local/lib/python2.7/site-packages/sage/finance/stock.pyc in close(self, *args, **kwds) 495 pass 496 --> 497 return TimeSeries([x.close for x in self.history(*args, **kwds)]) 498 499 def load_from_file(self, file): /ext/sage/sage-8.1/local/lib/python2.7/site-packages/sage/finance/stock.pyc in history(self, startdate, enddate, histperiod) 368 else: 369 try: --> 370 R = self._get_data('NASDAQ:', startdate, enddate, histperiod) 371 except RuntimeError: 372 R = self._get_data("NYSE:", startdate, enddate, histperiod) /ext/sage/sage-8.1/local/lib/python2.7/site-packages/sage/finance/stock.pyc in _get_data(self, exchange, startdate, enddate, histperiod) 619 else: 620 url = 'http://finance.google.com/finance/historical?cid=%s&startdate=%s&enddate=%s&histperiod=%s&output=csv'%(cid, startdate, enddate, histperiod) --> 621 data = urlopen(url).read() 622 if "Bad Request" in data or "The requested URL was not found on this server." in data: 623 raise RuntimeError("Google reported a wrong request (did you specify a cid?)") /ext/sage/sage-8.1/local/lib/python2.7/urllib2.pyc in urlopen(url, data, timeout, cafile, capath, cadefault, context) 152 else: 153 opener = _opener --> 154 return opener.open(url, data, timeout) 155 156 def install_opener(opener): /ext/sage/sage-8.1/local/lib/python2.7/urllib2.pyc in open(self, fullurl, data, timeout) 433 for processor in self.process_response.get(protocol, []): 434 meth = getattr(processor, meth_name) --> 435 response = meth(req, response) 436 437 return response /ext/sage/sage-8.1/local/lib/python2.7/urllib2.pyc in http_response(self, request, response) 546 if not (200 <= code < 300): 547 response = self.parent.error( --> 548 'http', request, response, code, msg, hdrs) 549 550 return response /ext/sage/sage-8.1/local/lib/python2.7/urllib2.pyc in error(self, proto, *args) 471 if http_err: 472 args = (dict, 'default', 'http_error_default') + orig_args --> 473 return self._call_chain(*args) 474 475 # XXX probably also want an abstract factory that knows when it makes /ext/sage/sage-8.1/local/lib/python2.7/urllib2.pyc in _call_chain(self, chain, kind, meth_name, *args) 405 func = getattr(handler, meth_name) 406 --> 407 result = func(*args) 408 if result is not None: 409 return result /ext/sage/sage-8.1/local/lib/python2.7/urllib2.pyc in http_error_default(self, req, fp, code, msg, hdrs) 554 class HTTPDefaultErrorHandler(BaseHandler): 555 def http_error_default(self, req, fp, code, msg, hdrs): --> 556 raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) 557 558 class HTTPRedirectHandler(BaseHandler): HTTPError: HTTP Error 403: Forbidden
In [ ]: