microsoftgraph / microsoftgraph/msgraph-sdk-python
BatchRequestItem use absolute url path instead of relative when, causing "Ressource not found" 400 error
オープン
まだ誰も着手していません。
priority:p1
type:bug
- 主要言語
- Python
- スター
- 630
- フォーク
- 96
- 平均マージ
- 15時間 20分
- マージ済み PR(30日)
- 3
説明
Describe the bug
Here is my code :
batch_requests = BatchRequestContent()
for message_id in message_ids:
query_params = MessagesRequestBuilder.MessagesRequestBuilderGetQueryParameters(
select=[
'id',
'conversationId',
'internetMessageId',
'subject',
'body',
'bodyPreview',
'from',
'toRecipients',
'ccRecipients',
'bccRecipients',
'receivedDateTime',
'sentDateTime',
'internetMessageHeaders',
'isRead',
'isDraft',
'importance',
'hasAttachments',
'categories',
]
)
request_configuration = RequestConfiguration(
query_parameters=query_params
)
request = service.me.messages.by_message_id(message_id).to_get_request_information(
request_configuration=request_configuration
)
request_id = str(uuid.uuid4())
batch_request_item = BatchRequestItem(id=request_id, request_information=request)
# batch_request_item.url = batch_request_item.url.replace('https://graph.microsoft.com/v1.0', '')
batch_requests.add_request(request_id=request_id, request=batch_request_item)
Without the line I've commented, it causes a 400 "Resource not found for the segment 'https:'".
I figured out the problem by looking at your code.
I guess it is not the behavior as you intended.
Expected behavior
The server answer a code HTTP 200
How to reproduce
1 - List message ids from Outlook
2 - Try to get the email content in batch
SDK Version
No response
Latest version known to work for scenario above?
No response
Known Workarounds
No response
Debug output
Click to expand log
```</details>
### Configuration
_No response_
### Other information
_No response_
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず Python の例を使って BatchRequestItem と BatchRequestContent.add_request を追跡し、次に batch 操作でリクエスト URL がどのように構築されるかを調べます。Outlook メッセージの batch の再現で動作を検証し、送信された項目が相対パスを使用し、回避策なしで HTTP 200 を受け取ることを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- api
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100