Python 2.6

This commit is contained in:
nikolark committed 2013-12-28 00:07:24 +01:00
1 parent a91d1c94d3
commit 69ce83590f
3 files changed
+4 -4

No files matched your search

+2 -2
View File
@@ -31,14 +31,14 @@ class DuskenApi(object):
self.oauth2_access_token = self.get_access_token(username, password, scope='write')
self.access_token = self.oauth2_access_token['access_token']
except requests.exceptions.HTTPError as e:
logging.error("Could not authenticate with API. Correct client_id, client_secret, username and password?\n{}".format(e))
logging.error("Could not authenticate with API. Correct client_id, client_secret, username and password?\n{0}".format(e))
return None
return self.access_token
def get_access_token(self, username, password, scope='read', grant_type='password'):
resp = requests.post(
"{}/oauth2/access_token/".format(self.base_url),
"{0}/oauth2/access_token/".format(self.base_url),
data=dict(
username=username,
password=password,
+1 -1
View File
@@ -9,7 +9,7 @@ class Members(object):
def __request_auth_headers(self):
return {
'Authorization': "Oauth {}".format(self._api.access_token)
'Authorization': "Oauth {0}".format(self._api.access_token)
}
+1 -1
View File
@@ -6,4 +6,4 @@ class DuskenAccessToken(models.Model):
user = models.OneToOneField(User)
def __unicode__(self):
return u"{} {}".format(self.user, self.access_token)
return u"{0} {1}".format(self.user, self.access_token)