README usage example raises `NameError: name 'subscription_info' is not defined`
还没有人认领这个 Issue。
评估
- 难度
- 1/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 78/100
- Issue 类型
- 文档
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- python
调研方向
在 README 中找到使用示例,并找到 PyPI 页面上对应的示例。按照 issue 中展示的结构,在调用 webpush 之前定义一个有代表性的 subscription_info 对象和数据。确认该示例不再引发 NameError,并展示预期的凭据和请求步骤。
由索引模型根据 Issue 内容生成。
描述
The usage example in the README (and the PyPI page) is:
from pywebpush import webpush
webpush(subscription_info,
data,
vapid_private_key="Private Key or File Path[1]",
vapid_claims={"sub": "mailto:YourEmailAddress"})
Copied verbatim into a clean environment it dies immediately, because neither subscription_info nor data is ever defined:
$ pip install pywebpush # 2.5.0
$ python sample.py
NameError: name 'subscription_info' is not defined
Reproduced 2026-11-21 and re-verified 2026-11-25 (pywebpush 2.5.0, Python 3.12.3). A new user can't tell what shape subscription_info is supposed to have, so the example stops them before the VAPID step it is trying to teach.
Suggested fix — show concrete literals, e.g.:
subscription_info = {
"endpoint": "https://push.example.com/...",
"keys": {"p256dh": "...", "auth": "..."},
}
data = "hello from pywebpush"
webpush(subscription_info,
data,
vapid_private_key="path/to/private_key.pem",
vapid_claims={"sub": "mailto:[email protected]"})
That runs through to the actual credential/request step, which is where a first-time user expects to spend their effort.
Found while running the documented quickstarts of 50 APIs from clean environments for a small benchmark (the Quickstart Friction Index — full data and a free sample: https://neoloong.gumroad.com/l/bxpkri). Happy to re-run and confirm once fixed.
- 主要语言
- Python
- 星标
- 381
- 派生
- 61
- 平均合并
- 6 分钟
- 30 天内合并 PR
- 1
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
web-push-libs/pywebpush 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 45/100
web-push-libs/pywebpush#190 · 2 条评论 ·
-
难度 4/5 3-5 天 新手友好度 25/100
web-push-libs/pywebpush#175 · 3 条评论 ·
-
难度 5/5 一周以上 新手友好度 25/100
web-push-libs/pywebpush#150 · 1 条评论 · 4 个 reaction ·
-
难度 5/5 一周以上 新手友好度 25/100
web-push-libs/pywebpush#149 · 4 条评论 ·
-
难度 5/5 一周以上 新手友好度 25/100
web-push-libs/pywebpush#147 · 8 条评论 ·
查看 web-push-libs/pywebpush 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
AgriciDaniel/claude-seo#572 ·
维护者通常 5 天内回复
-
area:print-dispatch
难度 2/5 1-3 小时 新手友好度 92/100
维护者通常 1 天内回复
-
area: docs domain: technical-writing good first issue type: documentation
难度 2/5 1-3 小时 新手友好度 80/100
Deepak3699/Ai_Mentor#919 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
area/geometry good first issue help wanted kind/doc-mismatch severity/4-minor
难度 2/5 1-3 小时 新手友好度 68/100
Apich-Organization/rssn#295 ·
维护者通常 1 天内回复