python - 如何在 url 中传递字典类型对象?
问题描述
我正在学习烧瓶。我尝试使用 request.args.get()。我对如何制作包含字典对象的 url 请求感到困惑
这是我的代码。我想向 /hello 发送 e url 请求,例如 "text":"Hello World"
@app.route("/hello")
def hello():
text = request.args.get("text",default="Hello World",type=str)
return text
解决方案
假设您尝试从浏览器访问此端点,并传递一个文本参数,请尝试如下 URL:
http://127.0.0.1:5000/hello?text=Fahad
推荐阅读
- python - 从迭代器返回一个浮点数
- spring - 自定义错误页面路由struts 2 + spring boot
- c# - 如果网站 URL 不包含任何语言代码,则执行某些操作
- php - WooCommerce 类别和子类别的永久链接
- google-apps-script - 通过链接和不受保护的范围共享电子表格
- json - 从响应中解析 PNG(没有默认的 JSON 解析)
- c# - Azure mip sdk 错误:NoPolicyException:未配置合规性策略:缺少
标签, - java - 未加载模式
- python - 图像分类异常 - 给定标签的 InvalidArgumentError
- java - 无法配置 Java Spring Boot 数据会话 Mongodb