current position:Home>Python development alert notification SMS alert
Python development alert notification SMS alert
2022-05-15 03:32:49【The sky is broken】
PYTHON Docking verification code SMS interface DEMO Example
This article provides you with PYTHON Language version verification code SMS interface docking DEMO Example
* Interface type : Trigger SMS interface , Support sending verification code SMS 、 Order notification SMS , Holiday blessings, etc .
* Account registration : Please open an account through this address http://user.ihuyi.com/?exClaO
* matters needing attention :
*(1) During commissioning , Please use the default SMS content : Your verification code is :【 Variable 】. Please don't leak the CAPTCHA to others .
*(2) Please use user name And APIkey To call the interface ,APIkey Available at the member center ;
*(3) This code is only for reference of accessing SMS interface , Customers can write their own according to their actual needs
mport urllib.parse
import urllib.request
# Address of the interface
url = 'http://106.ihuyi.com/webservice/sms.php?method=Submit'
# Define the requested data
values = {
'account':'xxxxxxxx',
'password':'xxxxxxxxxxxx',
'mobile':'134xxxxxxxx',
'content':' Your verification code is :7835. Please don't leak the CAPTCHA to others .',
'format':'json',
}
# Encode the data
data = urllib.parse.urlencode(values).encode(encoding='UTF8')
# Initiate request
req = urllib.request.Request(url, data)
response = urllib.request.urlopen(req)
res = response.read()
# Print the results
print(res.decode("utf8"))
-----------------------------------
#python2
# Interface type : Mutual wireless trigger SMS interface , Support sending verification code SMS 、 Order notification SMS, etc .
# Account registration : Please open an account through this address http://user.ihuyi.com/register.html
# matters needing attention :
#(1) During commissioning , Please use the default SMS content : Your verification code is :【 Variable 】. Please don't leak the CAPTCHA to others .
#(2) Please use APIID And APIKEY To call the interface , Available at the member center ;
#(3) This code is only for reference when accessing the mutual wireless short message interface , Customers can write their own according to their actual needs ;
#!/usr/local/bin/python
#-*- coding:utf-8 -*-
import httplib
import urllib
host = "106.ihuyi.com"
sms_send_uri = "/webservice/sms.php?method=Submit"
# View user name Log in to the user center -> Verification code notification SMS > Product overview ->API Interface information ->APIID
account = " user name "
# Check the password Log in to the user center -> Verification code notification SMS > Product overview ->API Interface information ->APIKEY
password = " password "
def send_sms(text, mobile):
params = urllib.urlencode({'account': account, 'password' : password, 'content': text, 'mobile':mobile,'format':'json' })
headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain"}
conn = httplib.HTTPConnection(host, port=80, timeout=30)
conn.request("POST", sms_send_uri, params, headers)
response = conn.getresponse()
response_str = response.read()
conn.close()
return response_str
if __name__ == '__main__':
mobile = "138xxxxxxxx"
text = " Your verification code is :121254. Please don't leak the CAPTCHA to others ."
print(send_sms(text, mobile))
copyright notice
author[The sky is broken],Please bring the original link to reprint, thank you.
https://en.pythonmana.com/2022/131/202205111539325609.html
The sidebar is recommended
- Common modules and third-party libraries of Python notes in class
- Educoder Linux and Python Programming 2021 (basic syntax of classes) - level 2: properties and instantiation of classes
- Educoder Linux and Python Programming 2021 (basic syntax of classes) - level 1: Declaration and definition of classes
- Educoder Linux and Python Programming 2021 (basic syntax of classes) - Level 3: binding and method calling
- Educoder Linux and Python Programming 2021 (basic syntax of classes) - level 4: static methods and class methods
- Educoder Linux and Python Programming 2021 (basic syntax of classes) - level 5: class import
- Python: unable to connect because the target computer actively refused
- If I can only choose one of the python introductory books on the market for you, I will choose this one
- Python simulation | how to manipulate the winning or losing of football matches
- How to learn after joining our Python zero foundation learning group?
guess what you like
Why choose Python as a programming language
Functions in Python
Python version of the lone brave | drawing + playing + Music Visualization
Smplify -python2. seven
Python office automation: use Python to automatically insert signatures into docx files
Python uses the opencv method to automatically insert the signed image into any position of the image
Python automatically inserts signatures into PDF files (pypdf2)
Basic learning notes of Python
Numpy, pandas, Matplotlib learning
[brush question Python] the problem of cutting and selling pipes to maximize profits
Random recommended
- [Python] gradient descent method to solve the trough of univariate quadratic function
- Python regular expression
- [Python GUI] wxPython automated data generator practice
- Python script compilation process
- [Python faiss library] (I) Introduction
- Python moves (copies) the pictures (files) under one file to another folder
- Python crawling 51job position information (regular violence matching)
- Python Post Bar irrigation script
- Python simulation QR code login Baidu
- Python calls wechat to send message call through COM port
- Analysis of birthday paradox in Python
- Equal scale compression of image files in Python
- Python dynamic programming (knapsack problem and longest common substring)
- Introduction to Python Programming and data analysis (I) basic use of built-in functions
- Introduction to Python Programming and data analysis (II) basic use of list derivation
- Introduction to Python Programming and data analysis (III) basic use of branch and process control
- Python turtle painting Chinese characters
- [a quick introduction and comparison of multiple languages -- JavaScript, typescript, python, golang, trust, Java, ruby]
- Relevant knowledge of Python web development (I)
- python3. Understanding of ID function in 6
- JSON data storage of MySQL in Python
- Python 3 development function
- My pandas
- Python game programming (pyGame)
- Python word cloud
- Python crawler crawls the Douban movie ranking list and writes it into CSV file for visual data analysis
- Python crawler crawls Beijing Xinfadi vegetables and displays them visually
- Python climbed the world university rankings
- Python crawling material commune picture
- Exception handling in Python and explanation of OS module
- Summation of corresponding position elements of multiple lists in Python
- [Python pandas] read excel table contents
- Python zip() function usage
- Application of Python startup subclass subprocess class
- Python's logging module
- MySQL application of Python
- Interesting games designed in Python
- Regularity of Python
- Jenkins reported an error in building Python project: CX_ Oracle. DatabaseError: DPI-1047: oci. dll is not the correct architecture
- Hamcrest assertion Library of Python