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
|
2024-06-14 02:16:05 +00:00
|
|
|
S3Id = "" # your S3 AWS Access Key
|
|
|
|
S3Key = "" # your S3 AWS Access Sercet Key
|
|
|
|
sdtcloudS3Client = sdtclouds3.sdtclouds3(S3Id, S3Key)
|
2024-03-05 08:44:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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()
|
|
|
|
|