8000 bug: def get_value; if json_data None throws err by sky-sharma · Pull Request #30 · ClearBlade/python-iot · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions clearblade/cloud/iot_v1/device_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,12 @@
import base64

def convertCredentialsFormatsFromString(credentials):
# Converts public Key Format from string to object of class PublicKeyFormat
for index, credential in enumerate(credentials):
if 'publicKey' in credential:
credential['publicKey']['format'] = PublicKeyFormat(credential['publicKey']['format'])
credentials[index] = DeviceCredential(credential['publicKey'], credential['expirationTime'])
if credentials is not None:
# Converts public Key Format from string to object of class PublicKeyFormat
for index, credential in enumerate(credentials):
if 'publicKey' in credential:
credential['publicKey']['format'] = PublicKeyFormat(credential['publicKey']['format'])
credentials[index] = DeviceCredential(credential['publicKey'], credential['expirationTime'])
return credentials

class Device():
Expand Down
5 changes: 3 additions & 2 deletions clearblade/cloud/iot_v1/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ def find_project_region_registry_from_parent(parent):
return project_region_registry_dict

def get_value(json_data, key):
if key in json_data:
return json_data[key]
if json_data is not None:
if key in json_data:
return json_data[key]
return None

class SingletonMetaClass(type):
Expand Down
0