Skip to content

Commit

Permalink
wrong unit of token expires_in value
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolfgang Malgadey committed Jan 1, 2017
1 parent 8d994c7 commit edd0a84
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions PyTado/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import json, datetime


class Tado:
"""Interacts with a Tado thermostat via public API.
Example usage: t = Tado('me@somewhere.com', 'mypasswd')
Expand All @@ -16,6 +17,7 @@ class Tado:
refresh_token = ''
refresh_at = datetime.datetime.now() + datetime.timedelta(minutes=5)


# 'Private' methods for use in class, Tado mobile API V1.9.
def _mobile_apiCall(self, cmd):
self._refreshToken()
Expand Down Expand Up @@ -45,7 +47,7 @@ def _setOAuthHeader(self, data):

self.refresh_token = refresh_token
self.refresh_at = datetime.datetime.now()
self.refresh_at = self.refresh_at + datetime.timedelta(minutes = expires_in)
self.refresh_at = self.refresh_at + datetime.timedelta(seconds = expires_in)

self.headers['Authorization'] = 'Bearer ' + access_token

Expand All @@ -66,8 +68,6 @@ def _refreshToken(self):
response = self.opener.open(req)
str_response = response.read().decode('utf-8')

print(str_response)

self._setOAuthHeader(json.loads(str_response))
return response

Expand Down

0 comments on commit edd0a84

Please sign in to comment.