Error 400 after successful file upload
まだ誰も着手していません。
評価
調査の方向性
まず、msgraph-sdk-python 1.17.0 を使って issue に示されているアップロードを再現し、LargeFileUploadTask.upload() と報告されている APIError 400 に焦点を当てます。リクエスト周辺のアップロード結果とエラー処理を調査し、アップロードが成功しているにもかかわらず例外が発生する理由を特定します。動作が説明され、SDK が結果を適切に報告するか、必要な workaround を文書化できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
I'm testing an upload process, here's an anonymized snippet of the code:
async def _upload_file(self, drive_id, filename, file_content, folder_name=None):
properties = DriveItemUploadableProperties(
additional_data={
"@microsoft.graph.conflictBehavior" : "replace",
},
)
request_body = CreateUploadSessionPostRequestBody(item=properties)
if folder_name is not None:
filename = folder_name + '/' + filename
session = await (
self.client
.drives.by_drive_id(drive_id)
.items.by_drive_item_id(f"root:/{filename}:")
.create_upload_session.post(body=request_body)
)
large_file_session = LargeFileUploadSession(
upload_url=session.upload_url,
expiration_date_time=session.expiration_date_time,
additional_data=session.additional_data,
is_cancelled=False,
next_expected_ranges=session.next_expected_ranges
)
task = LargeFileUploadTask(upload_session=large_file_session, request_adapter=self.client.request_adapter, stream=file_content)
upload_result = await task.upload()
return upload_result
The upload proceeds as expected, but I get the following exception anyway:
APIError
Code: 400
message: The server returned an unexpected status code and no error class is registered for this code 400
Expected behavior
Either a more clear error code if there is a problem I'm not seeing, or no error after a successful upload.
How to reproduce
See code in first section.
SDK Version
1.17.0
Latest version known to work for scenario above?
No response
Known Workarounds
Ignoring the exception for error 400 works, but is not ideal.
Debug output
APIError
Code: 400
message: The server returned an unexpected status code and no error class is registered for this code 400
Configuration
Windows 11, x64. I haven't tested on any other systems at present.
Other information
This may not be related to the SDK at all, but if it is an error in the request that isn't clear from the documentation I've read on this. I will echo comments elsewhere that the documentation on using the SDK for uploads is extremely limited and I had to cobble a lot of this together from responses to other questions here.
- 主要言語
- Python
- スター
- 630
- フォーク
- 96
- 平均マージ
- 15時間 20分
- マージ済み PR(30日)
- 3
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoftgraph/msgraph-sdk-python のほかの issue
-
status:waiting-for-triage type:bug
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
microsoftgraph/msgraph-sdk-python#1570 ·
-
status:waiting-for-triage type:bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
microsoftgraph/msgraph-sdk-python#1563 ·
-
Needs: Attention :wave: type:bug
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
microsoftgraph/msgraph-sdk-python#1287 · コメント 2 件 · リアクション 1 件 ·
-
status:waiting-for-triage type:bug
難易度 3/5 1〜2日 初心者へのやさしさ 52/100
microsoftgraph/msgraph-sdk-python#1578 ·
-
status:waiting-for-triage
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
microsoftgraph/msgraph-sdk-python#1557 ·
microsoftgraph/msgraph-sdk-python の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
learningequality/ricecooker#747 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
BSData/horus-heresy-3rd-edition#3171 ·
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
run-llama/llama_index#23199 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
KhronosGroup/glTF-Blender-IO#2769 ·