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
相关推荐
小珑也要变强22 分钟前
队列基础概念AI原吾3 小时前
掌握Python-uinput:打造你的输入设备控制大师机器视觉知识推荐、就业指导3 小时前
Qt/C++事件过滤器与控件响应重写的使用、场景的不同毕设木哥3 小时前
25届计算机专业毕设选题推荐-基于python的二手电子设备交易平台【源码+文档+讲解】珞瑜·3 小时前
Matlab R2024B软件安装教程weixin_455446173 小时前
Python学习的主要知识框架孤寂大仙v3 小时前
【C++】STL----list常见用法D11_3 小时前
Pandas缺失值处理花生了什么树~.4 小时前
python基础知识(四)--if语句,for\while循环她似晚风般温柔7894 小时前
Uniapp + Vue3 + Vite +Uview + Pinia 分商家实现购物车功能(最新附源码保姆级)