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

Catch connection errors and improve error messages

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

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

評価

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

調査の方向性

まず datadelivery/commands.py と datadelivery/s3.py の deliver フローを追跡し、特に _get_current_endpoint と _get_request を確認してから、利用できない API URL を使ってコマンドを再現します。HTTP 接続エラーが完全なトレースバックではなく、簡潔でユーザー向けのエラーとして報告されれば完了です。

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

説明

I had a stale configuration my ~/.datadelivery.yml file, pointing to a URL that's not live:

url: http://127.0.0.1:8000/api/v2/

When I tried to run a deliver command, I get the following:

$ datadelivery deliver -b sample --email [email protected]
Traceback (most recent call last):
  File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/urllib3-1.22-py3.6.egg/urllib3/connection.py", line 141, in _new_conn
    (self.host, self.port), self.timeout, **extra_kw)
  File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/urllib3-1.22-py3.6.egg/urllib3/util/connection.py", line 83, in create_connection
    raise err
  File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/urllib3-1.22-py3.6.egg/urllib3/util/connection.py", line 73, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 61] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/urllib3-1.22-py3.6.egg/urllib3/connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/urllib3-1.22-py3.6.egg/urllib3/connectionpool.py", line 357, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1239, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1285, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1234, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 964, in send
    self.connect()
  File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/urllib3-1.22-py3.6.egg/urllib3/connection.py", line 166, in connect
    conn = self._new_conn()
  File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/urllib3-1.22-py3.6.egg/urllib3/connection.py", line 150, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x10af6c908>: Failed to establish a new connection: [Errno 61] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/requests-2.18.4-py3.6.egg/requests/adapters.py", line 440, in send
    timeout=timeout
  File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/urllib3-1.22-py3.6.egg/urllib3/connectionpool.py", line 639, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/urllib3-1.22-py3.6.egg/urllib3/util/retry.py", line 388, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=8000): Max retries exceeded with url: /api/v2/s3-endpoints/?name=default (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x10af6c908>: Failed to establish a new connection: [Errno 61] Connection refused',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/dcl9/Code/python/datadelivery-cli/venv/bin/datadelivery", line 11, in <module>
    load_entry_point('datadelivery==0.0.1', 'console_scripts', 'datadelivery')()
  File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/datadelivery-0.0.1-py3.6.egg/datadelivery/__main__.py", line 14, in main
  File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/datadelivery-0.0.1-py3.6.egg/datadelivery/argparser.py", line 26, in parse_and_run_commands
  File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/datadelivery-0.0.1-py3.6.egg/datadelivery/argparser.py", line 73, in _run_deliver
  File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/datadelivery-0.0.1-py3.6.egg/datadelivery/commands.py", line 24, in deliver
  File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/datadelivery-0.0.1-py3.6.egg/datadelivery/commands.py", line 14, in _create_s3
  File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/datadelivery-0.0.1-py3.6.egg/datadelivery/s3.py", line 11, in __init__
  File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/datadelivery-0.0.1-py3.6.egg/datadelivery/s3.py", line 62, in _get_current_endpoint
  File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/datadelivery-0.0.1-py3.6.egg/datadelivery/s3.py", line 27, in _get_request
  File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/requests-2.18.4-py3.6.egg/requests/api.py", line 72, in get
    return request('get', url, params=params, **kwargs)
  File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/requests-2.18.4-py3.6.egg/requests/api.py", line 58, in request
    return session.request(method=method, url=url, **kwargs)
  File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/requests-2.18.4-py3.6.egg/requests/sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/requests-2.18.4-py3.6.egg/requests/sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/requests-2.18.4-py3.6.egg/requests/adapters.py", line 508, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=8000): Max retries exceeded with url: /api/v2/s3-endpoints/?name=default (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x10af6c908>: Failed to establish a new connection: [Errno 61] Connection refused',))
$ 

While we don't expect end-users to override their API url here, HTTP connection errors should be expected and relayed more succintcly :)

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

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

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

Duke-GCB/datadelivery-cli のほかの issue

Duke-GCB/datadelivery-cli の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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