We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 43fe65b commit 08c1b78Copy full SHA for 08c1b78
发送短信/main.py
@@ -0,0 +1,29 @@
1
+# @Time : 2020/4/14 15:42
2
+# @Author : Libuda
3
+# @FileName: main.py
4
+# @Software: PyCharm
5
+
6
+import requests
7
+import json
8
9
10
+class SendSms:
11
+ def __init__(self, api_key):
12
+ self.api_key = api_key
13
+ self.sing_send_url = 'https://sms.yunpian.com/v2/sms/single_send.json'
14
15
+ def send(self, code, mobile):
16
+ params = {
17
+ 'apikey': self.api_key,
18
+ 'mobile': mobile,
19
+ 'text': '【李晋军test】您的验证码是{}。如非本人操作,请忽略本短信'.format(code)
20
+ }
21
+ response = requests.post(self.sing_send_url, data=params)
22
+ resurt = json.loads(response.text)
23
+ return resurt
24
25
26
+if __name__ == '__main__':
27
+ sendsms = SendSms('65e7be01db4174b372508587a2e2c933')
28
+ res = sendsms.send('1234', '15735656005')
29
+ print(res)
0 commit comments