Follow these steps:
- sudo apt-get -y update
- sudo apt install python3-pip
- sudo pip3 install boltiot
now for open the text editor on Linux system and write the code for checking the status - sudo nano device_status.py
This is how the code for checking the status will look like===
from boltiot import Bolt
api_key = “XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX”
device_id = “BOLTXXXXXX”
mybolt = Bolt(api_key, device_id)
response = mybolt.isOnline()
print (response)
- sudo python3 device_status.py
Make sure that the program you are running is present in the same directory, if not then the program may not work!
To check your current location of directory you can paste the below command on the Linux system :
pwd
hope this helps!
In python, you can not name a file same as the inbuilt function/packages name. For example. email
is an inbuilt package of python and I think you have created a file with name random.py
also in your current directory.
To show the list of file in your current directory. Type listing command as below.
ls
Then remove the random.py file from your directory.
sudo rm random.py
Now run your program again and also send the screenshot of ls command.
Do let me know in case you need any other information.