BlueBrain / BlueBrain/nexus-python-sdk
improve error message for create_link method.
- 主要言語
- Python
- スター
- 6
- フォーク
- 10
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
I put a wrong media_type "directory" while calling create_link.
I would say it is not obvious to understand the issue.Here is the error I got:
[13:00:35]
OrderedDict([('@context', ['https://bluebrain.github.io/nexus/contexts/iam.json', 'https://bluebrain.github.io/nexus/contexts/resource.json']), ('@id', 'http://dev.nexus.ocp.bbp.epfl.ch/v1/permissions'),
('@type', 'Permissions'), ('permissions', ['acls/read', 'acls/write', 'events/read', 'files/write', 'organizations/create', 'organizations/read', 'organizations/write', 'permissions/read', 'permissions/write', 'projects/create', 'projects/read', 'projects/write', 'realms/read', 'realms/write', 'resolvers/write', 'resources/read', 'resources/write', 'schemas/write', 'storages/write', 'views/query', 'views/write']), ('_rev', 0), ('_createdAt', '1970-01-01T00:00:00Z'), ('_createdBy', 'http://dev.nexus.ocp.bbp.epfl.ch/v1/anonymous'), ('_updatedAt', '1970-01-01T00:00:00Z'), ('_updatedBy', 'http://dev.nexus.ocp.bbp.epfl.ch/v1/anonymous')])
Traceback (most recent call last):
File "test.py", line 32, in
result = nexus.files.create_link(org_label=ORG, project_label=PROJ, filename= 'circuit_renamed', filepath = 'courcol/circuit', media_type='directory', file_id='foobar')
File "/Users/courcol/DEV/nexus-sdk/nexus-python-sdk/nexussdk/files.py", line 139, in create_link
return http_put(request_path, body=payload, storage=storage_id)
File "/Users/courcol/DEV/nexus-sdk/nexus-python-sdk/nexussdk/utils/http.py", line 168, in http_put
response.raise_for_status()
File "/Users/courcol/DEV/nexus-sdk/venv/lib/python3.7/site-packages/requests/models.py", line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
test.py に示されている無効な media_type のケースを再現し、nexussdk/files.py の 139 行目付近にある create_link から、nexussdk/utils/http.py の 168 行目付近にある http_put まで追跡します。現在の HTTP エラーが有用なコンテキストを失う箇所を特定し、その後、結果のメッセージが無効な入力を明確に識別していることを確認して、関連する既存のテストを実行します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- api
- issue の種類
- バグ
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100