Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

LocalWebserver stuck if some other application is running on windows

オープン
#378 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python

調査の方向性

エントリポイント gauth.LocalWebserverAuth() から開始し、ポート 8080 をバインドして OAuth リダイレクトを構築する方法を追跡します。8080 が使用中の場合の動作を確認し、その後、フォールバックポートがリダイレクトに反映され、認可後にコマンドが完了することを確認します。

索引モデルが issue の本文から書いたものです。

説明

Hi,

When something is already running on port 8080, calling:

gauth.LocalWebserverAuth()
successfully opens the browser for OAuth, but after granting access, the redirect to http://localhost:8080/?code=... fails with ERR_CONNECTION_REFUSED.
The command line then just waits indefinitely for the code, because the local server never started on that port.

This happens because LocalWebserverAuth tries to bind to 8080 without checking if it’s free.

Proposed fix:
Check if the port is available before binding, and try alternatives in a small range (e.g., 8080–8085) before raising an error. Example using portpicker:


import portpicker

candidate_ports = [8080] + list(range(8081, 8086))
port_number = None
for p in candidate_ports:
    if portpicker.is_port_free(p):
        port_number = p
        break

if port_number is None:
    raise RuntimeError("No free port in range 8080–8085")

print(f"Using port {port_number}")

If a non-default port is selected, it would also need to be reflected in the OAuth URL so the redirect URI matches.
Users can pre-register multiple redirect URIs in Google Cloud Console to cover the fallback ports.

主要言語
Python
スター
670
フォーク
75
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

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

iterative/PyDrive2 のほかの issue

iterative/PyDrive2 の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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