Skip to content

Commit

Permalink
Merge pull request #203 from zabuldon/dev
Browse files Browse the repository at this point in the history
2021-05-01
  • Loading branch information
alandtse committed May 1, 2021
2 parents 011c9f9 + 2df733a commit 235f11b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ upload_to_pypi=true
check_build_status=false
remove_dist=false
hvcs=github
build_command = "pip install poetry && poetry build"
build_command=pip install poetry && poetry build

[pydocstyle]
ignore = D202, D212, D416, D213, D203, D407
Expand Down
4 changes: 2 additions & 2 deletions teslajsonpy/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,15 @@ async def __open(
resp = await getattr(self.websession, method)(
str(url), headers=headers, cookies=cookies
)
data = resp.json()
_LOGGER.debug("%s: %s", resp.status_code, json.dumps(data))
_LOGGER.debug("%s: %s", resp.status_code, resp.text)
if resp.status_code > 299:
if resp.status_code == 401:
if data and data.get("error") == "invalid_token":
raise TeslaException(resp.status_code, "invalid_token")
elif resp.status_code == 408:
raise TeslaException(resp.status_code, "vehicle_unavailable")
raise TeslaException(resp.status_code)
data = resp.json()
if data.get("error"):
# known errors:
# 'vehicle unavailable: {:error=>"vehicle unavailable:"}',
Expand Down

0 comments on commit 235f11b

Please sign in to comment.