小编Jan*_*l3r的帖子

request.args 中的flask 可选参数

我正在构建一个小型 API。现在,我正在针对需要稍后发送到函数的可选参数使用此变通方法解决方案。

if 'A' in request.args:
    A = request.args['A']
else:
    A = 0
Run Code Online (Sandbox Code Playgroud)

但我觉得必须有一些精确的东西。这似乎有点不专业。就像我在 argparse 工作时一样

parser.add_argument('--A', type=int, required=False')
Run Code Online (Sandbox Code Playgroud)

请问,是否可以稍微缩短第一部分并使用它们的一些功能?谢谢

flask python-3.x

4
推荐指数
1
解决办法
2050
查看次数

test.pypi 上的模块无法安装依赖项,即使它们存在

我已经完成了这个小包,我想在我的社区中分发。它现在在 test.pypi 上,当我想尝试安装它时,它给出了找不到依赖项的错误。

设置文件

...
install_requires=[
    'defcon>=0.6.0',
    'fonttools>=3.31.0'
]
...
Run Code Online (Sandbox Code Playgroud)

抛出这个错误

ERROR: Could not find a version that satisfies the requirement defcon>=0.6.0 (from sameWidther==0.6) (from versions: none)
ERROR: No matching distribution found for defcon>=0.6.0 (from sameWidther==0.6)
Run Code Online (Sandbox Code Playgroud)

但是当我手动安装时,它可以工作

pip install 'fonttools>=3.6.0'
pip install 'defcon>=0.6.0'

Run Code Online (Sandbox Code Playgroud)

python setuptools pypi

3
推荐指数
1
解决办法
369
查看次数

标签 统计

flask ×1

pypi ×1

python ×1

python-3.x ×1

setuptools ×1