在 web2py 中存储 API 密钥和密码 [英] Storing API keys and passwords in web2py

查看:39
本文介绍了在 web2py 中存储 API 密钥和密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个 web2py 应用程序,它将从不同来源提取大量数据.存储 API 密钥和密码的最佳方式是什么?Appconfig.ini 在我看来是一个糟糕的选择.

I am creating a web2py application which will pull a bunch of data from different sources. What's the best way to store the API keys and passwords? Appconfig.ini seems to me as a bad option here.

推荐答案

您可以使用 Python 密钥环库 更安全地将 API 密钥存储和检索到底层操作系统的密钥环服务中.作为可选的优化,您可以将密钥存储在 Web2py 的 cache.ram 中,以避免每次请求都必须从操作系统检索 API 密钥.

You can use the Python keyring lib to more safely store and retrieve an API key into the underlying Operating System's Keyring service. As an optional optimization, you can then store the key in Web2py's cache.ram to avoid having to retrieve API key from the OS for every request.

参见 https://pypi.python.org/pypi/keyring

这篇关于在 web2py 中存储 API 密钥和密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆