def make_doc(self, title): url = urlparse.urljoin(self.root_url,"/bokeh/doc/") data = self.ph.serialize_web({'title' : title}) response = self.session.post(url, data=data, verify=False) if response.status_code == 409: raise DataIntegrityException self.userinfo = get_json(response)
def make_doc(self, title): url = urlparse.urljoin(self.root_url, "/bokeh/doc/") data = self.ph.serialize_web({'title': title}) response = self.session.post(url, data=data, verify=False) if response.status_code == 409: raise DataIntegrityException self.userinfo = get_json(response)
def remove_doc(self, title): matching = [x for x in self.userinfo['docs'] \ if x.get('title') == title] docid = matching[0]['docid'] url = urlparse.urljoin(self.root_url, "/bokeh/doc/%s/" % docid) response = self.session.delete(url, verify=False) if response.status_code == 409: raise DataIntegrityException self.userinfo = get_json(response)
def remove_doc(self, title): matching = [x for x in self.userinfo['docs'] \ if x.get('title') == title] docid = matching[0]['docid'] url = urlparse.urljoin(self.root_url,"/bokeh/doc/%s/" % docid) response = self.session.delete(url, verify=False) if response.status_code == 409: raise DataIntegrityException self.userinfo = get_json(response)
def load_doc(self, docid): url = urlparse.urljoin(self.root_url, "/bokeh/getdocapikey/%s" % docid) resp = self.session.get(url, verify=False) if resp.status_code == 401: raise Exception, 'unauthorized' apikey = get_json(resp) if 'apikey' in apikey: self.docid = docid self.apikey = apikey['apikey'] print 'got read write apikey' else: self.docid = docid self.apikey = apikey['readonlyapikey'] print 'got read only apikey' self.models = {} url = urlparse.urljoin(self.root_url, "/bokeh/bb/") self.bbclient = bbmodel.ContinuumModelsClient(docid, url, self.apikey, self.ph) interactive_contexts = self.bbclient.fetch(typename='PlotContext') if len(interactive_contexts) > 1: print 'warning, multiple plot contexts here...' self.ic = interactive_contexts[0]
def load_doc(self, docid): url = urlparse.urljoin(self.root_url,"/bokeh/getdocapikey/%s" % docid) resp = self.session.get(url, verify=False) if resp.status_code == 401: raise Exception, 'unauthorized' apikey = get_json(resp) if 'apikey' in apikey: self.docid = docid self.apikey = apikey['apikey'] print 'got read write apikey' else: self.docid = docid self.apikey = apikey['readonlyapikey'] print 'got read only apikey' self.models = {} url = urlparse.urljoin(self.root_url, "/bokeh/bb/") self.bbclient = bbmodel.ContinuumModelsClient( docid, url, self.apikey) interactive_contexts = self.bbclient.fetch( typename='PlotContext') if len(interactive_contexts) > 1: print 'warning, multiple plot contexts here...' self.ic = interactive_contexts[0]
def update_userinfo(self): url = urlparse.urljoin(self.root_url, '/bokeh/userinfo/') self.userinfo = get_json(self.session.get(url, verify=False))