gluon/contrib/login_methods/dropbox_account.py, get client

This commit is contained in:
mdipierro
2012-10-29 22:22:36 -05:00
parent c61e0e11bb
commit 8dae3f832d
2 changed files with 9 additions and 1 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.2.1 (2012-10-29 21:38:03) stable
Version 2.2.1 (2012-10-29 22:22:31) stable
@@ -99,13 +99,21 @@ class DropboxAccount(object):
redirect('https://www.dropbox.com/logout')
return next
def get_client(self):
access_token = current.session.dropbox_access_token
self.sess.set_token(access_token[0], access_token[1])
self.client = client.DropboxClient(self.sess)
def put(self, filename, file):
if not hasattr(self,'client'): self.get_client()
return json.loads(self.client.put_file(filename, file))['bytes']
def get(self, filename, file):
if not hasattr(self,'client'): self.get_client()
return self.client.get_file(filename)
def dir(self, path):
if not hasattr(self,'client'): self.get_client()
return json.loads(self.client.metadata(path))