python send SMS

# Python using wireless to send SMS translation 
# interface types: Mutual million wireless trigger short message interface, supports sending SMS verification code, order notification SMS.
# Account Registration: Please open an account via this address http://sms.ihuyi.com/register.html
# Note:
# (1) during the commissioning, test using the default template, the default template detailed interface documentation;
# (2) use aPIID (see aPIID Sign In user Center -> SMS code -> products Overview -> aPIID) and APIkey to call interface;
# (3) the access code is only for reference mutually million wireless messaging interfaces to use, customers can write their own according to the actual needs;

# / usr / local / bin / Python!
# - * - Coding: UTF-8 - * -
Import http.client
Import urllib

Host = "106.ihuyi.com"
sms_send_uri = "/ WebService /sms.php?method=Submit "

# user name to log users -> SMS code -> products Overview -> apiId
the Account =" C58023834 "
# password password Sign In user Center View -> code SMS -> product Overview -> apiKey
password = "32dc4c13668beeb673ba91202d61405d"


DEF send_sms (text, Mobile):

{ 'Account': Account, 'password': password, 'Content': text, 'Mobile': Mobile, 'the format': 'JSON'})
headers = { "the Content-type": "file application / X-www- urlencoded-form "," the Accept ":" text / Plain "}
Conn = http.client.HTTPConnection (Host, Port = 80, 30 = timeout)
conn.request (" the POST ", sms_send_uri, the params, headers)
Response = Conn .getresponse ()
response_str = response.read ()
conn.Close ()
return response_str


IF __name__ == '__main__':
Mobile = "15,999,999,999"
text = "your verification code is: 123456. Please do not disclose to other code people. "

Print (send_sms (text, Mobile))

the Account and password in this position, the contrast could not find the picture position.

Guess you like

Origin www.cnblogs.com/pygo/p/12328152.html