20251114
This commit is contained in:
1 parent
f3a7c981d5
commit
48f119d087
5 files changed
+1196
-131
No files matched your search
+366
-85
@@ -1831,26 +1831,10 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 55,
|
||||
"execution_count": null,
|
||||
"id": "a8438d1b-ec3d-41e3-9c28-d44e88378c75",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-11-07T05:30:46.511261Z",
|
||||
"iopub.status.busy": "2025-11-07T05:30:46.510560Z",
|
||||
"iopub.status.idle": "2025-11-07T05:30:46.695916Z",
|
||||
"shell.execute_reply": "2025-11-07T05:30:46.695456Z",
|
||||
"shell.execute_reply.started": "2025-11-07T05:30:46.511196Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"1564 ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import openpyxl\n",
|
||||
"import json\n",
|
||||
@@ -1959,26 +1943,10 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 60,
|
||||
"execution_count": null,
|
||||
"id": "9caa8291-7d48-483b-992a-45f244567600",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-11-07T06:15:57.737800Z",
|
||||
"iopub.status.busy": "2025-11-07T06:15:57.737061Z",
|
||||
"iopub.status.idle": "2025-11-07T06:15:57.818225Z",
|
||||
"shell.execute_reply": "2025-11-07T06:15:57.817635Z",
|
||||
"shell.execute_reply.started": "2025-11-07T06:15:57.737730Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"1564\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import openpyxl\n",
|
||||
"import json\n",
|
||||
@@ -2235,17 +2203,9 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 66,
|
||||
"execution_count": null,
|
||||
"id": "80c2b300-6a4f-4223-9b7a-9b8978ad4609",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-11-10T09:49:26.870477Z",
|
||||
"iopub.status.busy": "2025-11-10T09:49:26.869856Z",
|
||||
"iopub.status.idle": "2025-11-10T09:49:26.920161Z",
|
||||
"shell.execute_reply": "2025-11-10T09:49:26.919605Z",
|
||||
"shell.execute_reply.started": "2025-11-10T09:49:26.870441Z"
|
||||
}
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
@@ -2304,49 +2264,25 @@
|
||||
"\n",
|
||||
"myclient = pymongo.MongoClient('mongodb://localhost:27017/')\n",
|
||||
"mydb = myclient[\"baogao\"]\n",
|
||||
"mycol = mydb[\"pdf1\"]\n",
|
||||
"\n",
|
||||
"place_id = 1\n",
|
||||
"place_code = \"20\"\n",
|
||||
"filename = 'data/镇海短信码2025.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"list1 = []\n",
|
||||
"for k, v in dict1.items():\n",
|
||||
" list1.append({'bh':k,'phone':v['phone'],'place_id':1,'code':v['code'],'fn':v['fn']})\n",
|
||||
"\n",
|
||||
"fi_path = '/home/songyi/python/mycrm/flask/pdf/files'\n",
|
||||
"fls = glob.glob(f'{fi_path}/{str(place_id)}/*.pdf')\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"for fn in fls:\n",
|
||||
" dict2 = {}\n",
|
||||
" fi_name =Path(fn).stem.split('-')[0]\n",
|
||||
" #fi_name =Path(fn).stem\n",
|
||||
" code = int(fi_name)\n",
|
||||
" dxm = list1[i]\n",
|
||||
" dict2 = {'place_id':place_id,'code':dxm,'fn':Path(fn).name}\n",
|
||||
" list2.append(dict2)\n",
|
||||
" i +=1\n",
|
||||
"x = mycol.insert_many(list2)\n",
|
||||
"print(len(list2),'ok') "
|
||||
"x = mycol.insert_many(list1)\n",
|
||||
"print(len(list1),'ok') "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 64,
|
||||
"execution_count": null,
|
||||
"id": "3b73e071-62ad-41fb-8b9d-57893dbf8a6f",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-11-09T05:50:17.521854Z",
|
||||
"iopub.status.busy": "2025-11-09T05:50:17.521109Z",
|
||||
"iopub.status.idle": "2025-11-09T05:50:17.537693Z",
|
||||
"shell.execute_reply": "2025-11-09T05:50:17.536539Z",
|
||||
"shell.execute_reply.started": "2025-11-09T05:50:17.521785Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[{'place_id': 1, 'code': '016368', 'fn': '016368-陈兴旺.pdf'}, {'place_id': 1, 'code': '013403', 'fn': '013403-孙震.pdf'}, {'place_id': 1, 'code': '008553', 'fn': '008553-张国栋.pdf'}, {'place_id': 1, 'code': '015775', 'fn': '015775-张永战.pdf'}, {'place_id': 1, 'code': '015867', 'fn': '015867-高再玲.pdf'}, {'place_id': 1, 'code': '015770', 'fn': '015770-许丹萍.pdf'}, {'place_id': 1, 'code': '021574', 'fn': '021574-杨子敬.pdf'}, {'place_id': 1, 'code': '013141', 'fn': '013141-何文丰.pdf'}, {'place_id': 1, 'code': '015635', 'fn': '015635-王宇光.pdf'}, {'place_id': 1, 'code': '016224', 'fn': '016224-方丽华.pdf'}, {'place_id': 1, 'code': '014081', 'fn': '014081-谢希杭.pdf'}, {'place_id': 1, 'code': '019323', 'fn': '019323-赖佳奇.pdf'}, {'place_id': 1, 'code': '020747', 'fn': '020747-贺海鹏.pdf'}, {'place_id': 1, 'code': '014609', 'fn': '014609-靳贤锐.pdf'}, {'place_id': 1, 'code': '016309', 'fn': '016309-张鹏宇.pdf'}, {'place_id': 1, 'code': '015206', 'fn': '015206-王贺永.pdf'}, {'place_id': 1, 'code': '015184', 'fn': '015184-彭志涛.pdf'}, {'place_id': 1, 'code': '018706', 'fn': '018706-陈佳欣.pdf'}, {'place_id': 1, 'code': '021568', 'fn': '021568-张峻哲.pdf'}, {'place_id': 1, 'code': '016402', 'fn': '016402-石晓雨.pdf'}, {'place_id': 1, 'code': '016023', 'fn': '016023-何正楠.pdf'}, {'place_id': 1, 'code': '008319', 'fn': '008319-陈文近.pdf'}, {'place_id': 1, 'code': '014701', 'fn': '014701-陈顺.pdf'}, {'place_id': 1, 'code': '013564', 'fn': '013564-徐凯华.pdf'}, {'place_id': 1, 'code': '015014', 'fn': '015014-赵刚.pdf'}, {'place_id': 1, 'code': '010481', 'fn': '010481-徐旭东.pdf'}, {'place_id': 1, 'code': '016354', 'fn': '016354-张婕.pdf'}]\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"\n",
|
||||
"import os,sys,shutil\n",
|
||||
@@ -2380,10 +2316,355 @@
|
||||
"print(len(list2),'ok') "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "9e271c11-dc3f-4746-82c8-380a2ae685d8",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 生成有电话人员验证码"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "c0380a6e-fdfe-4df1-b235-652e605ac312",
|
||||
"id": "fe8d4bbf-f293-42e5-8e13-172083431fdd",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import os,sys,shutil\n",
|
||||
"import json\n",
|
||||
"import math\n",
|
||||
"import glob\n",
|
||||
"import random\n",
|
||||
"from pathlib import Path\n",
|
||||
"import pymongo\n",
|
||||
"\n",
|
||||
"filename = 'data/镇海人员2025.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict2 = json.load(fl)\n",
|
||||
"\n",
|
||||
"dict3 = {}\n",
|
||||
"for k, v in dict2.items():\n",
|
||||
" if 'phone' in v.keys():\n",
|
||||
" dict3[k] = v\n",
|
||||
"\n",
|
||||
"myclient = pymongo.MongoClient('mongodb://localhost:27017/')\n",
|
||||
"mydb = myclient[\"baogao\"]\n",
|
||||
"\n",
|
||||
"place_id = 1\n",
|
||||
"place_code = \"01\"\n",
|
||||
"dw_name = \"中国石化镇海炼化公司\"\n",
|
||||
"dw_jc = \"中国石化镇海炼化公司\"\n",
|
||||
"fi_path = '/home/songyi/pdf-typescript-old2/镇海石化2025'\n",
|
||||
"fls = glob.glob(f'{fi_path}/*.pdf')\n",
|
||||
"\n",
|
||||
"code_list = []\n",
|
||||
"for i in range(10): # 0~9\n",
|
||||
" code_list.append(str(i))\n",
|
||||
"list1 = []\n",
|
||||
"mycol = mydb[\"pdf\"]\n",
|
||||
"\n",
|
||||
"i = 0\n",
|
||||
"while i < len(fls):\n",
|
||||
" code = random.sample(code_list,5) #随机取4位数\n",
|
||||
" code_num = ''.join(code) \n",
|
||||
" if place_code+code_num not in list1:\n",
|
||||
" list1.append(place_code+code_num)\n",
|
||||
" i +=1\n",
|
||||
"i = 0\n",
|
||||
"list2= []\n",
|
||||
"\n",
|
||||
"for fn in fls:\n",
|
||||
" dict2 = {}\n",
|
||||
" fi_name =Path(fn).stem.split('-')[0]\n",
|
||||
" #fi_name =Path(fn).stem\n",
|
||||
" code = fi_name\n",
|
||||
" dxm = list1[i]\n",
|
||||
" dict2 = {'place_id':place_id,'code':dxm,'fn':Path(fn).name}\n",
|
||||
" list2.append(dict2)\n",
|
||||
" i +=1\n",
|
||||
"x = mycol.insert_many(list2)\n",
|
||||
"print(len(list2),'ok') \n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "2f9d6915-9933-48e1-94a7-9ae8fa4c8844",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import os,sys,shutil\n",
|
||||
"import json\n",
|
||||
"import math\n",
|
||||
"import glob\n",
|
||||
"import random\n",
|
||||
"from pathlib import Path\n",
|
||||
"import pymongo\n",
|
||||
"\n",
|
||||
"filename = 'data/镇海人员2025.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict2 = json.load(fl)\n",
|
||||
"\n",
|
||||
"dict3 = {}\n",
|
||||
"for k, v in dict2.items():\n",
|
||||
" if 'phone' in v.keys():\n",
|
||||
" dict3[k] = v\n",
|
||||
"print(len(dict3))\n",
|
||||
"myclient = pymongo.MongoClient('mongodb://localhost:27017/')\n",
|
||||
"mydb = myclient[\"baogao\"]\n",
|
||||
"\n",
|
||||
"place_id = 1\n",
|
||||
"place_code = \"01\"\n",
|
||||
"dw_name = \"中国石化镇海炼化公司\"\n",
|
||||
"dw_jc = \"中国石化镇海炼化公司\"\n",
|
||||
"fi_path = '/home/songyi/pdf-typescript-old2/镇海石化2025'\n",
|
||||
"fls = glob.glob(f'{fi_path}/*.pdf')\n",
|
||||
"\n",
|
||||
"code_list = []\n",
|
||||
"for i in range(10): # 0~9\n",
|
||||
" code_list.append(str(i))\n",
|
||||
"list1 = []\n",
|
||||
"mycol = mydb[\"pdf\"]\n",
|
||||
"\n",
|
||||
"i = 0\n",
|
||||
"while i < len(fls):\n",
|
||||
" code = random.sample(code_list,4) #随机取4位数\n",
|
||||
" code_num = ''.join(code) \n",
|
||||
" if place_code+code_num not in list1:\n",
|
||||
" list1.append(place_code+code_num)\n",
|
||||
" i +=1\n",
|
||||
"i = 0\n",
|
||||
"list2= []\n",
|
||||
"dict4 = {}\n",
|
||||
"for fn in fls:\n",
|
||||
" dict2 = {}\n",
|
||||
" fi_name =Path(fn).stem.split('-')[0]\n",
|
||||
" #fi_name =Path(fn).stem\n",
|
||||
" code = fi_name\n",
|
||||
" if code in dict3.keys():\n",
|
||||
" \n",
|
||||
" dxm = list1[i]\n",
|
||||
" \n",
|
||||
" dict2 = {'bh':code,'phone':dict3[code]['phone'],'place_id':place_id,'code':dxm,'fn':Path(fn).name}\n",
|
||||
" dict4[code] = {'phone':dict3[code]['phone'],'place_id':place_id,'code':dxm,'fn':Path(fn).name}\n",
|
||||
" list2.append(dict2)\n",
|
||||
" i +=1\n",
|
||||
"x = mycol.insert_many(list2)\n",
|
||||
"filename = f'data/镇海短信码2025.json'\n",
|
||||
"with open(filename,'w') as fl:\n",
|
||||
" json.dump(dict4,fl , ensure_ascii=False) \n",
|
||||
"print('ok!') "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "d7c31e0f-b2c9-4fb3-a265-9032114954ca",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 批量发送短信(测试)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "9879c239-37c8-4054-8b39-99643d6f8792",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from tencentcloud.common import credential\n",
|
||||
"from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException\n",
|
||||
"from tencentcloud.sms.v20210111 import sms_client, models\n",
|
||||
"from tencentcloud.common.profile.client_profile import ClientProfile\n",
|
||||
"from tencentcloud.common.profile.http_profile import HttpProfile\n",
|
||||
"import json\n",
|
||||
"import pymongo\n",
|
||||
"import time\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"dw_jc = \"镇海炼化公司\"\n",
|
||||
"filename = 'data/镇海短信码2025.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"\n",
|
||||
"place_id = 1\n",
|
||||
"\n",
|
||||
"i=1\n",
|
||||
"#dict2 = {375: {'phone': '13793180751', 'code': '0379208'}}\n",
|
||||
"for k, v in dict1.items():\n",
|
||||
" phone = '+86'+v['phone']\n",
|
||||
" yzm = v['code']\n",
|
||||
" try: \n",
|
||||
" secretId = \"AKID22rVyvSqbikXFFvav31ykc9YmqjN6KYc\"\n",
|
||||
" secretKey = \"51XVL1YxDKI6mJh8au6DDuTskS1RhwJX\"\n",
|
||||
" cred = credential.Credential(secretId, secretKey) \n",
|
||||
" httpProfile = HttpProfile()\n",
|
||||
" httpProfile.reqMethod = \"POST\" # post请求(默认为post请求)\n",
|
||||
" httpProfile.reqTimeout = 60 # 请求超时时间,单位为秒(默认60秒)\n",
|
||||
" httpProfile.endpoint = \"sms.tencentcloudapi.com\" # 指定接入地域域名(默认就近接入)\n",
|
||||
" clientProfile = ClientProfile()\n",
|
||||
" clientProfile.signMethod = \"TC3-HMAC-SHA256\" # 指定签名算法\n",
|
||||
" clientProfile.language = \"en-US\"\n",
|
||||
" clientProfile.httpProfile = httpProfile\n",
|
||||
" client = sms_client.SmsClient(cred, \"ap-guangzhou\", clientProfile)\n",
|
||||
" req = models.SendSmsRequest()\n",
|
||||
" req.SmsSdkAppId = \"1400140089\"\n",
|
||||
" req.SignName = \"坤铭教育\"\n",
|
||||
" req.TemplateId = \"1875765\" \n",
|
||||
" req.TemplateParamSet = [dw_jc,yzm]\n",
|
||||
" req.PhoneNumberSet = [phone]\n",
|
||||
" req.SessionContext = \"\"\n",
|
||||
" req.ExtendCode = \"\"\n",
|
||||
" req.SenderId = \"\"\n",
|
||||
" #resp = client.SendSms(req)\n",
|
||||
" #dict3 = json.loads(resp.to_json_string(indent=2))\n",
|
||||
"\n",
|
||||
" #print(v['phone'],dict3['SendStatusSet'][0][\"Message\"])\n",
|
||||
" print(i,v['phone'],v['fn'], v['code'])\n",
|
||||
" i+=1\n",
|
||||
" except TencentCloudSDKException as err:\n",
|
||||
" print(v['phone'],err)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "8f68da91-de56-4cc5-abe6-2b275133e558",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 单个发送短信"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "9663b933-57f4-486c-80e6-f9d513bbe6a8",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from tencentcloud.common import credential\n",
|
||||
"from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException\n",
|
||||
"from tencentcloud.sms.v20210111 import sms_client, models\n",
|
||||
"from tencentcloud.common.profile.client_profile import ClientProfile\n",
|
||||
"from tencentcloud.common.profile.http_profile import HttpProfile\n",
|
||||
"import json\n",
|
||||
"import pymongo\n",
|
||||
"import time\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"dw_jc = \"中国石化镇海炼化公司\"\n",
|
||||
"filename = 'data/镇海短信码2025.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"\n",
|
||||
"phone = '+86'+'13793180751'\n",
|
||||
"yzm = '019031'\n",
|
||||
"try: \n",
|
||||
" secretId = \"AKID22rVyvSqbikXFFvav31ykc9YmqjN6KYc\"\n",
|
||||
" secretKey = \"51XVL1YxDKI6mJh8au6DDuTskS1RhwJX\"\n",
|
||||
" cred = credential.Credential(secretId, secretKey) \n",
|
||||
" httpProfile = HttpProfile()\n",
|
||||
" httpProfile.reqMethod = \"POST\" # post请求(默认为post请求)\n",
|
||||
" httpProfile.reqTimeout = 60 # 请求超时时间,单位为秒(默认60秒)\n",
|
||||
" httpProfile.endpoint = \"sms.tencentcloudapi.com\" # 指定接入地域域名(默认就近接入)\n",
|
||||
" clientProfile = ClientProfile()\n",
|
||||
" clientProfile.signMethod = \"TC3-HMAC-SHA256\" # 指定签名算法\n",
|
||||
" clientProfile.language = \"en-US\"\n",
|
||||
" clientProfile.httpProfile = httpProfile\n",
|
||||
" client = sms_client.SmsClient(cred, \"ap-guangzhou\", clientProfile)\n",
|
||||
" req = models.SendSmsRequest()\n",
|
||||
" req.SmsSdkAppId = \"1400140089\"\n",
|
||||
" req.SignName = \"坤铭教育\"\n",
|
||||
" req.TemplateId = \"1875765\" \n",
|
||||
" req.TemplateParamSet = [dw_jc,yzm]\n",
|
||||
" req.PhoneNumberSet = [phone]\n",
|
||||
" req.SessionContext = \"\"\n",
|
||||
" req.ExtendCode = \"\"\n",
|
||||
" req.SenderId = \"\"\n",
|
||||
" resp = client.SendSms(req)\n",
|
||||
" dict3 = json.loads(resp.to_json_string(indent=2))\n",
|
||||
"\n",
|
||||
" print(phone,dict3['SendStatusSet'][0][\"Message\"])\n",
|
||||
"except TencentCloudSDKException as err:\n",
|
||||
" print(v['phone'],err)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "ab5f292c-1b1e-46a0-9b5b-f7be1573d438",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 批量发送短信"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "4426aa59-2754-4571-9270-dcb7b66bc941",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from tencentcloud.common import credential\n",
|
||||
"from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException\n",
|
||||
"from tencentcloud.sms.v20210111 import sms_client, models\n",
|
||||
"from tencentcloud.common.profile.client_profile import ClientProfile\n",
|
||||
"from tencentcloud.common.profile.http_profile import HttpProfile\n",
|
||||
"import json\n",
|
||||
"import pymongo\n",
|
||||
"import time\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"dw_jc = \"镇海炼化公司\"\n",
|
||||
"filename = 'data/镇海短信码2025.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"\n",
|
||||
"place_id = 1\n",
|
||||
"\n",
|
||||
"i=1\n",
|
||||
"#dict2 = {375: {'phone': '13793180751', 'code': '0379208'}}\n",
|
||||
"for k, v in dict1.items():\n",
|
||||
" phone = '+86'+v['phone']\n",
|
||||
" yzm = v['code']\n",
|
||||
" try: \n",
|
||||
" secretId = \"AKID22rVyvSqbikXFFvav31ykc9YmqjN6KYc\"\n",
|
||||
" secretKey = \"51XVL1YxDKI6mJh8au6DDuTskS1RhwJX\"\n",
|
||||
" cred = credential.Credential(secretId, secretKey) \n",
|
||||
" httpProfile = HttpProfile()\n",
|
||||
" httpProfile.reqMethod = \"POST\" # post请求(默认为post请求)\n",
|
||||
" httpProfile.reqTimeout = 60 # 请求超时时间,单位为秒(默认60秒)\n",
|
||||
" httpProfile.endpoint = \"sms.tencentcloudapi.com\" # 指定接入地域域名(默认就近接入)\n",
|
||||
" clientProfile = ClientProfile()\n",
|
||||
" clientProfile.signMethod = \"TC3-HMAC-SHA256\" # 指定签名算法\n",
|
||||
" clientProfile.language = \"en-US\"\n",
|
||||
" clientProfile.httpProfile = httpProfile\n",
|
||||
" client = sms_client.SmsClient(cred, \"ap-guangzhou\", clientProfile)\n",
|
||||
" req = models.SendSmsRequest()\n",
|
||||
" req.SmsSdkAppId = \"1400140089\"\n",
|
||||
" req.SignName = \"坤铭教育\"\n",
|
||||
" req.TemplateId = \"1875765\" \n",
|
||||
" req.TemplateParamSet = [dw_jc,yzm]\n",
|
||||
" req.PhoneNumberSet = [phone]\n",
|
||||
" req.SessionContext = \"\"\n",
|
||||
" req.ExtendCode = \"\"\n",
|
||||
" req.SenderId = \"\"\n",
|
||||
" resp = client.SendSms(req)\n",
|
||||
" #dict3 = json.loads(resp.to_json_string(indent=2))\n",
|
||||
" time.sleep(3)\n",
|
||||
"\n",
|
||||
" #print(v['phone'],dict3['SendStatusSet'][0][\"Message\"])\n",
|
||||
" print(i,v['phone'],v['fn'], v['code'])\n",
|
||||
" i+=1\n",
|
||||
" except TencentCloudSDKException as err:\n",
|
||||
" print(v['phone'],err)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "02501165-d375-4101-8a97-107b52cccdc2",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
|
||||
Reference in new issue
Block a user