Skip to content

Commit

Permalink
Merge pull request #12 from rospogrigio/fix_local_variable_res
Browse files Browse the repository at this point in the history
Fixing UnboundLocalError: local variable 'res' referenced before assignment
  • Loading branch information
rospogrigio authored Dec 3, 2021
2 parents 06db29c + 388dc74 commit 52aed6a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions custom_components/daikin_residential/daikin_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,15 @@ async def refreshAccessToken(self):
"AuthFlow": "REFRESH_TOKEN_AUTH",
"AuthParameters": {"REFRESH_TOKEN": self.tokenSet["refresh_token"]},
}

try:
func = functools.partial(requests.post, url, headers=headers, json=ref_json)
res = await self.hass.async_add_executor_job(func)
# res = requests.post(url, headers=headers, json=ref_json)
except Exception as e:
_LOGGER.error("REQUEST FAILED: %s", e)
raise e

_LOGGER.debug("refreshAccessToken response code: %s", res.status_code)
_LOGGER.debug("refreshAccessToken response: %s", res.json())
res_json = res.json()
Expand Down

0 comments on commit 52aed6a

Please sign in to comment.