-
Notifications
You must be signed in to change notification settings - Fork 0
/
example_api.py
31 lines (27 loc) · 1.09 KB
/
example_api.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import thingsboard_api as tb
import pandas as pd
df = pd.read_csv (r'devices_names.csv')
df.head()
for i in range(len(df)):
dev_name = str(df.iloc[i][0])
tb.create_dev(dev_name=dev_name,
dev_profile="Device-Name",
token_name=dev_name,
url = "http://ip_address:port",
username = "[email protected]",
password = "tenant")
print("Created "+dev_name)
for i in range(len(df)):
dev_name = str(df.iloc[i][0])
token_fromDev = tb.get_tokenByDevName(dev_name=dev_name,
url = "http://ip_address:port",
username = "[email protected]",
password = "tenant")
print("Token returned "+token_fromDev)
for i in range(len(df)):
dev_name = str(df.iloc[i][0])
tb.delete_dev(dev_name=dev_name,
url = "http://ip_address:port",
username = "[email protected]",
password = "tenant")
print("Deleted "+dev_name)