Permalink
Browse files

Better check and json -> json()

  • Loading branch information...
1 parent ccbcc01 commit c4423db1906fef944656af09ecd81596fe3c7eb1 @tebeka committed Mar 18, 2013
Showing with 4 additions and 4 deletions.
  1. +4 −4 bokeh/mpl.py
View
8 bokeh/mpl.py
@@ -171,7 +171,7 @@ def scatter(self, *args, **kwargs):
def plot(self, x, y=None, color=None, data_source=None,
scatter=False):
- if data_source.typename == 'PandasDataSource':
+ if data_source and (data_source.typename == 'PandasDataSource'):
if self.plotclient.plot_sources.get(data_source.id):
data_source = self.plotclient.plot_sources.get(data_source.id)
else:
@@ -351,14 +351,14 @@ def ws_conn_string(self):
def update_userinfo(self):
url = urlparse.urljoin(self.root_url, '/bokeh/userinfo/')
- self.userinfo = self.session.get(url, verify=False).json
+ self.userinfo = self.session.get(url, verify=False).json()
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 = resp.json
+ apikey = resp.json()
if 'apikey' in apikey:
self.docid = docid
self.apikey = apikey['apikey']
@@ -384,7 +384,7 @@ def make_doc(self, title):
response = self.session.post(url, data=data, verify=False)
if response.status_code == 409:
raise DataIntegrityException
- self.userinfo = response.json
+ self.userinfo = response.json()
def remove_doc(self, title):
matching = [x for x in self.userinfo['docs'] \

1 comment on commit c4423db

@hhuuggoo

I'm going to go ahead and merge this, but we'll need to modify it - we have some users on requests .13 which does not have the json() function. In the near term we should handle both cases

Please sign in to comment.