-
Notifications
You must be signed in to change notification settings - Fork 1
Enroll a single device #1
base: master
Are you sure you want to change the base?
Conversation
|
||
|
||
WOTT_ENDPOINT = os.getenv('WOTT_ENDPOINT', 'https://api.wott.io') | ||
PROJECT = 'wott-244904' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not used
|
||
WOTT_ENDPOINT = os.getenv('WOTT_ENDPOINT', 'https://api.wott.io') | ||
PROJECT = 'wott-244904' | ||
LOCATION = 'europe-west1' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not used
def create_client(): | ||
# iot.DeviceManagerClient doesn't do this himself, unlike other Google libs. | ||
if 'GOOGLE_APPLICATION_CREDENTIALS' in os.environ: | ||
with open(os.environ['GOOGLE_APPLICATION_CREDENTIALS']) as key: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's a file, not a key
return client | ||
|
||
|
||
def create_registry(client, project_name, location, registry_name, pubsub_topic, ca_cert): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pls fix PEP8 compliance of this function code
device = client.create_device(registry_path, device) | ||
else: | ||
print(f'Updating device {device_name}') | ||
device = types.Device( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't you use the device instance received in the try
clause?
|
||
|
||
|
||
if __name__ == '__main__': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pls carefully check all arguments' required
and default
values. Many of them look wrong
WoTTsecurity/api#278
Note: the
--device
argument is optional because if it's not specified this utility should list all devices and enroll all of them. To do this it needs an API key (WoTTsecurity/api#278), so it's not yet implemented.