python - Flask:如何使用第二个查询获取参数,该参数用于第一个查询调用的函数?
问题描述
它会是这样的:
@app.route('/phone_code', methods=['POST'])
def get_phone_code():
return request.args.get('phone_code')
@app.route('/sign_in', methods=['GET', 'POST'])
def sign_in():
with pyrogram.Client(
phone_number=request.args.get('phone_number')
phone_code=get_phone_code()) as client:
pass
return 'some specific server stuff'
那么如何从get_phone_code
另一个 Flask 请求中获取代码呢?
UPD:首先我需要调用sign_in()
which runssend_code()
函数并生成phone_code_hash
用于检查有效性的phone_code
所以sign_in()
必须在获取之前调用phone_code
解决方案
推荐阅读
- python - QSQLITE ATTACH DATABASE 挂起的原因可能是什么
- python - 在游戏中实现验证规则的问题
- sql - 如何从 SQL 中字符串特定部分左侧的字符串中选择 3 个字符?
- php - PHP MySQL选择范围内的值
- python - 如何使用另一个数据框中的值对数据框中的每个元素应用限制
- avro - Spring Cloud Stream + Avro
- postgresql - Docker Compose: run a command at build time but not at run time
- sql - 使用 Apache Spark SQL 连接到 Oracle 的 Databricks 秘密
- forms - Codeigniter 4 模块形成动作
- flutter - 既然标题已弃用,如何处理 BottomNavigationBarItem 上的文本溢出?