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

Some calls are confusing when unauthenticated #16

Open
jinnatar opened this issue Mar 25, 2021 · 1 comment
Open

Some calls are confusing when unauthenticated #16

jinnatar opened this issue Mar 25, 2021 · 1 comment
Labels

Comments

@jinnatar
Copy link
Owner

If there is no valid cloud state saved:

%> util/devicelist.py     
WARNING:absl:Cloud attribute remotetoken not found in state.
Traceback (most recent call last):
  File "util/devicelist.py", line 21, in <module>
    main()
  File "util/devicelist.py", line 11, in main
    devs = hub.devices()
  File "/home/artanicus/python-cozify.git/cozify/hub.py", line 40, in devices
    _fill_kwargs(kwargs)
  File "/home/artanicus/python-cozify.git/cozify/hub.py", line 542, in _fill_kwargs
    kwargs['cloud_token'] = cloud.token()
  File "/home/artanicus/python-cozify.git/cozify/cloud.py", line 346, in token
    return _getAttr('remotetoken')
  File "/home/artanicus/python-cozify.git/cozify/cloud.py", line 304, in _getAttr
    raise AttributeError
AttributeError

Instead, it should be detected that auth hasn't been done successfully and error on that, not an internal consistency AttributeError.

@jinnatar jinnatar added the bug label Mar 25, 2021
@jinnatar
Copy link
Owner Author

jinnatar commented Mar 5, 2022

This is a bit better today but still not great:

%> util/devicelist.py 
CRITICAL:absl:Default hub not known, you should run cozify.authenticate()
Traceback (most recent call last):
  File "util/devicelist.py", line 21, in <module>
    main()
  File "util/devicelist.py", line 11, in main
    devs = hub.devices()
  File "/home/artanicus/.local/lib/python3.8/site-packages/cozify/hub.py", line 37, in devices
    _fill_kwargs(kwargs)
  File "/home/artanicus/.local/lib/python3.8/site-packages/cozify/hub.py", line 546, in _fill_kwargs
    kwargs['hub_id'] = _get_id(**kwargs)
  File "/home/artanicus/.local/lib/python3.8/site-packages/cozify/hub.py", line 535, in _get_id
    return default()
  File "/home/artanicus/.local/lib/python3.8/site-packages/cozify/hub.py", line 456, in default
    raise AttributeError
AttributeError

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

No branches or pull requests

1 participant