Files
zdoc.app ada4cd75a3 docs(zh-CN): sync Chinese docs with latest upstream changes (#304)
* docs(zh-CN): sync Chinese docs with latest upstream changes

* update

---------

Co-authored-by: neo <neo.dowithless@gmail.com>
2026-03-02 22:28:27 -08:00

528 B

paths
paths
**/*.py
**/*.pyi

Python 安全

本文档基于 通用安全指南 扩展,补充了 Python 相关的内容。

密钥管理

import os
from dotenv import load_dotenv

load_dotenv()

api_key = os.environ["OPENAI_API_KEY"]  # Raises KeyError if missing

安全扫描

  • 使用 bandit 进行静态安全分析:
    bandit -r src/
    

参考

查看技能:django-security 以获取 Django 特定的安全指南(如适用)。