Oct-01-2021, 09:05 AM
Try this.
import requests headers = { "Content-Type": "application/json", } data = '{\n"from": "35315313424",\n"to": "447860041755",\n"text":\ "Apifonica API provides a really cool SMS messaging service"\n}' response = requests.post( "https://api.apifonica.com/v2/accounts/%7BaccountSID%7D/calls", headers=headers, data=data, auth=("{accountSID}", "{authToken}"), )Or with HTTPBasicAuth.
import requests from requests.auth import HTTPBasicAuth headers = { "Content-Type": "application/json", } data = '{\n"from": "35315313424",\n"to": "447860041755",\n"text":\ "Apifonica API provides a really cool SMS messaging service"\n}' u = HTTPBasicAuth('my accountSID' , 'my authToken') response = requests.post( "https://api.apifonica.com/v2/accounts/%7BaccountSID%7D/calls", headers=headers, data=data, auth=u, )