跳至主要內容
如何用 Python 隐藏你的 API 密钥

你好,我是悦创。

博客首发:https://bornforthis.cn/posts/19.html

有时您需要在代码中存储敏感信息,例如密码或 API 密钥,而在 Python 中最简洁的方法是使用 os 和 dotenv 模块。

为此,您需要安装 dotenv 模块,而 os 模块是标准 Python 模块,无需安装。

在命令行中,输入:


AI悦创原创...大约 2 分钟外文文章外文文章
How to hide you API key with Python

Sometimes you need to store sensitive information in your code, such as passwords or API keys, and the cleanest way to do it in Python is using the os and dotenv modules.

For that, you will need to install the dotenv module, while the os module is a standard Python module and needs no installation.


AI悦创原创...大约 2 分钟外文文章外文文章