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

Creating a board with local ip/key and validateKey=True results in error #39

Closed
natekspencer opened this issue Jun 2, 2023 · 1 comment
Assignees
Labels
triage Issues is being researched

Comments

@natekspencer
Copy link
Contributor

Describe the bug
When attempting to create a board with localApi and validateKey, an error message is returned:

.read() is only available when using local API or by using a read/write enabled API key.
Pass "readWrite=True" along with your apiKey to enable readWrite mode.

Steps to reproduce

from vestaboard import Board

try:
    client = Board(localApi={"ip": "10.0.0.100", "key": "someKey"}, validateKey=True)
except Exception as ex:
    print(ex)

Expected behavior
readWrite should not need to be passed for localApi

@ShaneSutro ShaneSutro added the triage Issues is being researched label Jul 21, 2023
@ShaneSutro ShaneSutro self-assigned this Jul 21, 2023
@ShaneSutro
Copy link
Owner

ShaneSutro commented Jul 22, 2023

Hey @natekspencer! So the valdateKey method was only ever intended for the cloud read/write endpoint since it's possible to have an API key that does not have read access. Conversely, all local API keys are read/write by default, so there's no need to validate the key, so I didn't anticipate folks trying to use it here, thus the odd error.

However, while I was looking into this to at least make the error better fit the real reason, I stumbled upon a reason why one would want to validate the API key... namely the local API returns a 200 and a blank message if you use an invalid key rather than throwing an error. With this in mind, I added support to validate the local API key along with a message that displays when validation is successful. If an invalid API key is used and the board returns a blank message, I'm currently just showing a warning since there's a (very unlikely) case where the key is valid and the board is just actually empty, so I didn't want to throw an error and stop execution in that case.
Let me know if this resolves the issue! Fix for this is in v1.2.4, which has been published onto PyPi!

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

No branches or pull requests

2 participants