Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP Error during Authenticate #1

Closed
kdvlr opened this issue Sep 21, 2019 · 2 comments
Closed

HTTP Error during Authenticate #1

kdvlr opened this issue Sep 21, 2019 · 2 comments

Comments

@kdvlr
Copy link
Contributor

kdvlr commented Sep 21, 2019

Just found this repo. Seems very well put together. I tried using the cli.py as well as importing the teslapy in my own python script. It fails with the following error.

Traceback (most recent call last):
  File "./test.py", line 3, in <module>
    tesla.fetch_token()
  File "/docker/homeassistant/config/python_scripts/TeslaPy/teslapy.py", line 69, in fetch_token
    response = self.api('AUTHENTICATE', data=data)
  File "/docker/homeassistant/config/python_scripts/TeslaPy/teslapy.py", line 162, in api
    return self.request(endpoint['TYPE'], uri, data=kwargs)
  File "/docker/homeassistant/config/python_scripts/TeslaPy/teslapy.py", line 55, in request
    response.raise_for_status()  # Raise HTTPError, if one occurred
  File "/usr/lib/python3/dist-packages/requests/models.py", line 940, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: invalid_request. The request is missing a required parameter, includes an unsupported parameter value, or is otherwise malformed for url: https://owner-api.teslamotors.com/oauth/token

I tried to recreate the cache.json with a valid token, but that did not seem to work either.

@kdvlr
Copy link
Contributor Author

kdvlr commented Sep 21, 2019

I solved it by changing data=data to **data.

@kdvlr kdvlr closed this as completed Sep 21, 2019
@tdorssers
Copy link
Owner

Thanks! I have fixed fetch_token and refresh_token as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants