README usage example raises `NameError: name 'subscription_info' is not defined`

オープン 初心者向け
#216 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
1/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
ドキュメント
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
documentation

調査の方向性

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分
マージ済み PR(30日)
1

環境構築

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

web-push-libs/pywebpush のほかの issue

web-push-libs/pywebpush の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。