thingsboard-python-rest-client
thingsboard-python-rest-client copied to clipboard
[BUG] Unable to remove nor edit the default tenant
Description
The default tenant created on a new instance of Thingsboard has almost every attribute blank, including email. Using thingsboard python rest client I am unable to get this tenant ID, because the email attribute in the class Tenant is required and a method RestClientCE.get_tenants(...) returns an invalid Tenant in the data field. Even though an exception should be thrown, it isn't - a ValueError object is put into the data field of the PageDataTenant.
Required to reproduce
thingsboard/tb-postgres image tb-rest-client 3.6.3
To Reproduce
Run a clean Thingsboard container according to this guide: https://thingsboard.io/docs/user-guide/install/docker/ Then run this script:
from tb_rest_client.rest_client_ce import *
tb = RestClientCE("localhost:8080")
tb.login("[email protected]", "sysadmin")
tenants = tb.get_tenants(page_size=10, page=0)
print(type(tenants.data[0]))
As you will see, the type of the PageDataTenant is not a Tenant, but a ValueError.
ToDo
It would be intuitive for the email not to be required, as it can be left blank when using a Thingsboard GUI.
I realized that this issue is not directly related to the python rest client, as this code is generated from a Swagger API. I'm creating a proper issue on the thingsboard repo referencing this one.