mqtt-s3-sdt-sdk-template/main.py

29 lines
634 B
Python
Raw Normal View History

2024-03-05 08:44:46 +00:00
import sdtcloudpubsub
import sdtclouds3
import time
import uuid
# call sdtcloudpubsub
sdtcloudMqttClient = sdtcloudpubsub.sdtcloudpubsub()
2024-05-21 06:22:04 +00:00
sdtcloudMqttClient.setClient(f"device-app-{uuid.uuid1()}") # parameter is client ID(string)
2024-03-05 08:44:46 +00:00
# call sdtclouds3
sdtcloudS3Client = sdtclouds3.sdtclouds3()
def runAction():
while True:
uploadFile = "./text.txt"
result = sdtcloudS3Client.uploadData(uploadFile, "")
msg = {
"message": "Hello World",
"uploadFile": result
}
2024-05-21 06:22:04 +00:00
sdtcloudMqttClient.pubMessage(msg)
2024-03-05 08:44:46 +00:00
time.sleep(10)
if __name__ == "__main__":
runAction()