Is there a procedure to send HTTP POST message without hard-coding endpoint and topic name. I am able to give the message as a variable but not endpoint and Topic.
This code is working absolutely fine:
import requests
caPath = "aws-iot-rootCA.crt"
certPath = "cert.pem.crt"
keyPath = "privkey.pem.crt"
parameters = (
('qos', '1'),
)
payload= """{
"message": "Hello"
}"""
r = requests.post('https://******endpoint*****.us-west-2.amazonaws.com:8443/topics/TopicName',
params=parameters,,data=payload,
cert=(certPath,keyPath,caPath))
But how to give topic name and AWS endpoint as variables?