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
相关推荐
itmigrate3 分钟前
Rust 里的所有权误区:不是不写 clone 就叫高性能Brilliantwxx9 分钟前
【Linux】 文件访问与路径解析:目录、文件名、dentry、路径缓冲与 dcache 全解析摇滚侠27 分钟前
《On Java 中文版 基础卷》阅读笔记 初始化和清理 08xiangyun6141 分钟前
C++ 手撕 shared_ptr:引用计数与控制块到底长什么样?专注仿真1 小时前
Agentic RAG算法详解XiYang-DING1 小时前
P4009.和为K的子数组个数 & P5522.异或和为 k 的子数组个数学习论之费曼学习法1 小时前
无人值守AI内容矩阵实战(8):标题 A/B 实验的 6 个工程实现细节,隔日对比与自动判胜东哥16881 小时前
我用 DeepSeek 做了 4 个零依赖的赚钱小工具,全部开源Carl_奕然1 小时前
【机器视觉】最强算法之:3D高斯泼溅(3D Gaussian Splatting)jaysee-sjc1 小时前
【苍穹外卖】Day12:工作台数据看板与 Excel 报表导出