import requests
import json
import pymysql
code = input("请输入id:")
#print(code)
code1 = (repr(code))
#print(code1)
#通过调接口生成加密后code
url = "http://XXX/generateId"
params = {
"List": code
}
headers = {'content-type': "application/json", "Label": "S"}
r = requests.post(url, data=json.dumps(params), headers=headers)
#print(r.text)
#获取上个步骤的加密code
connection = pymysql.connect(host="base", user="A", password="V", db="C", port=3306, charset='utf8')
cur = connection.cursor()
sql = "select crypt from C t where t.code = %s" %(code1)
#print(sql)
try:
cur.execute(sql)
result = cur.fetchall()
except:
print('Error:unable to fetch data')
#print(result)
cryptcode = result[0]
#print(cryptcode)
results = "https://XXX&Id=%s"%(code)+"&Idcrypt=%s"%(cryptcode)
print("ID二维码生成链接:%s \n"%(results))
connection.close()
input('press enter to exit!')
python脚本 ——二维码链接获取
wshlp1234562024-02-04 14:12
相关推荐
程序员小远4 分钟前
软件测试之功能测试详解小小怪7505 分钟前
C++中的函数式编程金山几座7 分钟前
C#学习记录-事件我的xiaodoujiao22 分钟前
API接口自动化测试详细图文教程学习系列1--序章ZhengEnCi29 分钟前
P1B-Python环境配置基础完全指南-Windows系统安装与验证小杍随笔30 分钟前
【Rust 语言编程知识与应用:基础数据类型详解】Yupureki36 分钟前
《MySQL数据库基础》1. 数据库基础m0_716667071 小时前
NumPy入门:高性能科学计算的基础enmouhuadou1 小时前
快速运行matlab仿真方法m0_706653231 小时前
使用C-Free进行浮点变量的四则运算指南