pyecobee/__init__.py
def request_tokens(self):
        ''' Method to request API tokens from ecobee '''
        url = 'https://api.ecobee.com/token'
        params = {'grant_type': 'ecobeePin', 'code': self.authorization_code,
                  'client_id': self.api_key}
        try:
            request = requests.post(url, params=params)
        except RequestException:
            logger.warn("Error connecting to Ecobee.  Possible connectivity outage."
                        "Could not request token.")
            return
        if request.status_code == requests.codes.ok:
            self.access_token = request.json()['access_token']
            self.refresh_token = request.json()['refresh_token']
            self.write_tokens_to_file()
            self.pin = None
        else:
            logger.warn('Error while requesting tokens from ecobee.com.'
                  ' Status code: ' + str(request.status_code))
            return
def request_tokens(self):
        ''' Method to request API tokens from ecobee '''
        url = 'https://api.ecobee.com/token'
        params = {'grant_type': 'ecobeePin', 'code': self.authorization_code,
                  'client_id': self.api_key}
        try:
            request = requests.post(url, params=params)
        except RequestException:
            logger.warn("Error connecting to Ecobee.  Possible connectivity outage."
                        "Could not request token.")
            return
        if request.status_code == requests.codes.ok:
            self.access_token = request.json()['access_token']
            self.refresh_token = request.json()['refresh_token']
            self.write_tokens_to_file()
            self.pin = None
        else:
            logger.warn('Error while requesting tokens from ecobee.com.'
                  ' Status code: ' + str(request.status_code))
            return
def request_tokens ( self ) : url = 'https://api.ecobee.com/token' params = { 'grant_type' : 'ecobeePin' , 'code' : self . authorization_code , 'client_id' : self . api_key } try : request = requests . post ( url , params = params ) except RequestException : logger . warn ( "Error connecting to Ecobee.  Possible connectivity outage." "Could not request token." ) return if request . status_code == requests . codes . ok : self . access_token = request . json ( ) [ 'access_token' ] self . refresh_token = request . json ( ) [ 'refresh_token' ] self . write_tokens_to_file ( ) self . pin = None else : logger . warn ( 'Error while requesting tokens from ecobee.com.' ' Status code: ' + str ( request . status_code ) ) return
Method to request API tokens from ecobee
Method to request API tokens from ecobee