def _open_raise(self, req, create_session=True): """Do all required to make an HTTP request, paying attention to whether login is required, and trying to relogin once if our session has expired.""" if create_session and not self.session_id: self.login() fp = self._make_request(req) if fp.getcode() == 401 and create_session: self.login() fp = self._make_request(req) if fp.getcode() != 200: raise ValueError('%d: %s' % (fp.getcode(), fp.read())) raw = fp.read() try: return json.loads(util.json_fixup(raw)) except ValueError, e: raise ValueError('%r (%r)' % (e, raw))
def conv_dt(s): return float(util.json_fixup('"%s"' % s))