bachya/simplisafe-python

AttributeError: type object 'API' has no attribute 'access_token'

Closed this issue · 3 comments

Describe the bug
So I followed all of the steps outlined here. When I got to "Creating an API Object" and "Key API Object Properties", I tried putting api.access_token in place of the # ... in the script under "Creating an API Object." When I run this modified script, I get an error saying AttributeError: type object 'API' has no attribute 'access_token'.

Expected behavior
The expected behavior to me is to print the access token to the console. Has this changed?

For context, here is the entire script I'm trying to run.


from aiohttp import ClientSession
from simplipy import API


async def main() -> None:
    """Create the aiohttp session and run."""
    async with ClientSession() as session:
        simplisafe = await API.async_from_auth(
            "EDrAyjgwlqWC68CU0ZUpt7OXElugtO54KxHZBImPPNb2P",
            "wmGMQ1bzf0pws4XIWxZ9JPfMWPB7NJRsZ0TFXHsm4FTzVBZyccyQ",
            session=session,
        )

        API.access_token


asyncio.run(main())

You're attempting to access that property on the class itself, which won't work. Try using the instantiated object:

simplisafe.access_token

There hasn't been any activity on this issue recently, so it has been marked as stale.
Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment.
This issue will be closed if no further activity occurs. Thanks!