Error : Web push send from python backend
还没有人认领这个 Issue。
评估
调研方向
Start with the shown webpush call, private_key.pem input, subscription object, and Python base64 traceback, then reproduce the failure using the supplied values. Done means identifying the source of the incorrect-padding error and documenting the required input format or a precise fix.
由索引模型根据 Issue 内容生成。
描述
Hello, I'm having a problem when I try to run a notification, I think I'm following the documentation to the letter.
Information
Keys generated with vpaid (python): https://github.com/web-push-libs/vapid/tree/main/python
- The keys that I indicate are for testing...
PrivateKey [private_key.pem]
----BEGIN PRIVATE KEY-----
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQg4zLDHdp8DtxtcAO4
MZVGeyp2JLJyVrqaMII75nGeAC+hRANCAATW1506jo86/0Ek72wj/AYgGZ6d1R3i
wabGfNb7DlMSmIrdYbrgLLI6HgnszgCGM1ORilZ95RoW9x0ER8+h8SI2
-----END PRIVATE KEY-----
ApplicationServerKey:
BNbXnTqOjzr_QSTvbCP8BiAZnp3VHeLBpsZ81vsOUxKYit1huuAssjoeCezOAIYzU5GKVn3lGhb3HQRHz6HxIjY
Subscription (chrome client: successfully generated with the ApplicationServerKey):
{"endpoint":"https://fcm.googleapis.com/fcm/send/eN9gFAJxIeA:APA91bGRifdlYB8pDgJ9wEYNxxIrVkT5Lb2cNTvtiU55-0bFmV4KGVBuIYbk67NRPjflK4FFdA5tJBPtHVaMMV0IzLrDvBtpBy1cd5VDzrKjXbBN5rJ5NWF-RurzHaFX2iBiun_ypzCT","expirationTime":null,"keys":{"p256dh":"BD9sOH3XIEbgk1x_KvtLbCLvyYEnuQ972W4LaTUnvl_-7vB_q8IzToFKGWK_QaTtUhWBj-Tb556xPuR9uXmr6-E","auth":"X0Zy2i_2WC3tkjElaK3D2g"}}
Code
webpush(
vapid_private_key="private_key.pem",
vapid_claims={"sub": "mailto:[email protected]"},
subscription_info=subscription,
data=data
)
Error
...
return base64.urlsafe_b64decode(data + b"===="[len(data) % 4:])
File "/usr/lib/python3.8/base64.py", line 133, in urlsafe_b64decode
return b64decode(s)
File "/usr/lib/python3.8/base64.py", line 87, in b64decode
return binascii.a2b_base64(s)
binascii.Error: Incorrect padding
@jrconlin Could you tell me what I may be doing wrong?
- 主要语言
- Python
- 星标
- 379
- 派生
- 61
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 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#147 · 8 条评论 ·
-
难度 3/5 1-2 天 新手友好度 25/100
web-push-libs/pywebpush#145 · 7 条评论 ·
查看 web-push-libs/pywebpush 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
common-workflow-language/cwl-utils#477 ·
维护者通常 1 天内回复
-
Add dependabot未关闭feat
难度 2/5 1 小时以内 新手友好度 72/100
open-nudge/opentemplate#204 ·
维护者通常 1 天内回复
-
github-stale-ci-pr-closer: KV state is double-wrapped, never persists, and hits the depth-32 limit可能已有人在做 @VascoSch92 今天认领。 未关闭priority:medium ready-for-dev
难度 2/5 1-3 小时 新手友好度 72/100
OpenHands/extensions#781 ·
维护者通常 1 天内回复
-
bug good first issue
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
curriculum documentation quality
难度 2/5 1-3 小时 新手友好度 78/100
githubnext/gh-aw-workshop#4638 ·
维护者通常 1 天内回复