29 lines
659 B
Python
29 lines
659 B
Python
import sdtcloudpubsub
|
|
import sdtclouds3
|
|
import time
|
|
import uuid
|
|
|
|
# call sdtcloudpubsub
|
|
sdtcloudMqttClient = sdtcloudpubsub.sdtcloudpubsub()
|
|
mqttClient = sdtcloudMqttClient.setClient(f"device-app-{uuid.uuid1()}") # parameter is client ID(string)
|
|
|
|
# call sdtclouds3
|
|
sdtcloudS3Client = sdtclouds3.sdtclouds3()
|
|
|
|
|
|
|
|
def runAction():
|
|
while True:
|
|
uploadFile = "./text.txt"
|
|
result = sdtcloudS3Client.uploadData(uploadFile, "")
|
|
msg = {
|
|
"message": "Hello World",
|
|
"uploadFile": result
|
|
}
|
|
sdtcloudMqttClient.pubMessage(mqttClient, msg)
|
|
time.sleep(10)
|
|
|
|
if __name__ == "__main__":
|
|
runAction()
|
|
|