python - 为什么即使请求详细信息相同,MS 图形浏览器和我的 python 请求结果也会不同
问题描述
我正在使用 ms-graph user:findMeetingTimes
api 来检索给定用户的免费会议时间。
我使用https://developer.microsoft.com/en-us/graph/graph-explorer
withPOST https://graph.microsoft.com/v1.0/me/findMeetingTimes
检索免费会议时间,我使用 Pythonrequests
模块检索具有相同参数的相同信息,但使用 python requests
then in调用时结果不正确graph-explorer
。访问权限在文档中提供。对我来说,从 Python api 调用 rest 时它看起来"meetingDuration": "PT1H"
不起作用,然后它默认每 30 分钟返回一次,如user:findMeetingTimes
文档中所述。有人遇到过这个问题吗?
唯一的区别是start/end
时间。我预计start/end
会是 1h (设置为"meetingDuration": "PT1H"
),但默认情况下它会返回 30mins
如果我使用graph-explorer
Microsoft 提供的测试,这不是问题,但是当我从我的 Python api 调用时,问题就出现了......
请求正文:
{
"attendees": [
{
"emailAddress": {
"address": "<user-email>",
"name": "<user>"
},
"type": "Required"
}
],
"timeConstraint": {
"timeslots": [
{
"start": {
"dateTime": "2019-01-24T19:00",
"timeZone": "AUS Eastern Standard Time"
},
"end": {
"dateTime": "2019-01-24T21:00",
"timeZone": "AUS Eastern Standard Time"
}
}
]
},
"meetingDuration": "PT1H"
}
请求标头:
{'return-client-request-id': 'true', 'client-request-id': '<client-id>', 'Authorization': 'Bearer <token>', 'Content-Type': 'application/json', 'Prefer': 'outlook.timezone="AUS Eastern Standard Time"', 'Accept': 'application/json', 'User-Agent': 'appointments/1.0'}
我期望这样的结果:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#microsoft.graph.meetingTimeSuggestionsResult",
"emptySuggestionsReason": "",
"meetingTimeSuggestions": [
{
"confidence": 100,
"organizerAvailability": "free",
"meetingTimeSlot": {
"start": {
"dateTime": "2019-01-24T19:00:00.0000000",
"timeZone": "AUS Eastern Standard Time"
},
"end": {
"dateTime": "2019-01-24T20:00:00.0000000",
"timeZone": "AUS Eastern Standard Time"
}
},
"attendeeAvailability": [],
"locations": []
},
{
"confidence": 100,
"organizerAvailability": "free",
"meetingTimeSlot": {
"start": {
"dateTime": "2019-01-24T20:00:00.0000000",
"timeZone": "AUS Eastern Standard Time"
},
"end": {
"dateTime": "2019-01-24T21:00:00.0000000",
"timeZone": "AUS Eastern Standard Time"
}
},
"attendeeAvailability": [],
"locations": []
}
]
}
但是使用 Python API 我得到了这个:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#microsoft.graph.meetingTimeSuggestionsResult",
"emptySuggestionsReason": "",
"meetingTimeSuggestions": [
{
"attendeeAvailability": [],
"confidence": 100.0,
"locations": [],
"meetingTimeSlot": {
"end": {
"dateTime": "2019-01-24T20:00:00.0000000",
"timeZone": "AUS Eastern Standard Time"
},
"start": {
"dateTime": "2019-01-24T19:30:00.0000000",
"timeZone": "AUS Eastern Standard Time"
}
},
"organizerAvailability": "free"
},
{
"attendeeAvailability": [],
"confidence": 100.0,
"locations": [],
"meetingTimeSlot": {
"end": {
"dateTime": "2019-01-24T20:30:00.0000000",
"timeZone": "AUS Eastern Standard Time"
},
"start": {
"dateTime": "2019-01-24T20:00:00.0000000",
"timeZone": "AUS Eastern Standard Time"
}
},
"organizerAvailability": "free"
},
{
"attendeeAvailability": [],
"confidence": 100.0,
"locations": [],
"meetingTimeSlot": {
"end": {
"dateTime": "2019-01-24T21:00:00.0000000",
"timeZone": "AUS Eastern Standard Time"
},
"start": {
"dateTime": "2019-01-24T20:30:00.0000000",
"timeZone": "AUS Eastern Standard Time"
}
},
"organizerAvailability": "free"
},
{
"attendeeAvailability": [],
"confidence": 100.0,
"locations": [],
"meetingTimeSlot": {
"end": {
"dateTime": "2019-01-24T21:30:00.0000000",
"timeZone": "AUS Eastern Standard Time"
},
"start": {
"dateTime": "2019-01-24T21:00:00.0000000",
"timeZone": "AUS Eastern Standard Time"
}
},
"organizerAvailability": "free"
},
{
"attendeeAvailability": [],
"confidence": 100.0,
"locations": [],
"meetingTimeSlot": {
"end": {
"dateTime": "2019-01-24T22:00:00.0000000",
"timeZone": "AUS Eastern Standard Time"
},
"start": {
"dateTime": "2019-01-24T21:30:00.0000000",
"timeZone": "AUS Eastern Standard Time"
}
},
"organizerAvailability": "free"
}
]
}
Host: graph.microsoft.com
User-Agent: <mozilla>
Accept: application/json, text/plain, */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Referer: https://developer.microsoft.com/en-us/graph/graph-explorer
Content-type: application/json
Authorization: Bearer <token>
Content-Length: 716
Origin: https://developer.microsoft.com
Connection: keep-alive
和我请求中的标题:
{
"Accept": "application/json",
"Authorization": "Bearer <token>",
"Content-Type": "application/json",
"Prefer": "outlook.timezone=AUS Eastern Standard Time",
"User-Agent": "myApp/1.0",
"client-request-id": "<client-id>",
"return-client-request-id": "true"
}
解决方案
推荐阅读
- javascript - 未捕获的 SyntaxError:位置 678 处的 JSON 中的意外数字
- javascript - 从获取结果中的数组获取值(React.js)
- javascript - Webpack 拆分块没有被执行
- android - AndroidViewModel 在后台更改方向时被杀死
- mysql - JSON / MySQL:列表索引必须是整数或切片,而不是 str
- postgresql - 触发历史记录 - 如何定义最后更新的列?
- reactjs - 如何在没有 onClick 事件的情况下在渲染函数中使用 setState
- java - 如何对两个 ArrayList 进行排序,同时合并为一个?
- java - java indexof总是返回-1
- c# - 强制窗口重绘