microsoftgraph / microsoftgraph/msgraph-sdk-python

BatchRequestItem use absolute url path instead of relative when, causing "Ressource not found" 400 error

Đang mở
#1,015 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

priority:p1 type:bug
Ngôn ngữ chính
Python
Star
630
Fork
96
Merge trung bình
15 giờ 20 phút
Pull request đã merge (30 ngày)
3

Mô tả

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_

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách truy vết BatchRequestItem và BatchRequestContent.add_request bằng ví dụ Python, sau đó kiểm tra cách URL yêu cầu được xây dựng cho các thao tác batch. Xác minh hành vi bằng bản tái hiện batch tin nhắn Outlook và xác nhận rằng mục được gửi sử dụng đường dẫn tương đối và nhận HTTP 200 mà không cần workaround.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
api
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.