-2

error - {"type":"error","message":"Invalid mobile number. You must have entered either less than 10 digits or there is an alphabetic character in the mobile number field in API","code":"202"}

import http.client
ph='9999999999'
conn = http.client.HTTPSConnection("api.msg91.com")
print(ph)
payload = '''{"sender": "SOCKET",
  "route": "4",
  "country": "91",
  "sms": [
    {
      "message": "Testing",
      "to": "'+str(ph)+'"
    }
  ]}'''

1 Answers1

1

You can either use format or f-strings concept of Python. Below code snippet is an example of f-strings

var_name= "World"
payload = f"Hello {var_name}"

print(payload)
Hello World

For format:

var_name = "World"
payload = "Hello {var}".format(var=var_name)
print(payload)
Hello World
Anurag Choudhary
  • 752
  • 1
  • 11
  • 16