我已经编写了一个代码来获取当前文件,但我需要获取同一文件的先前版本来比较和识别更改。
这是我使用图形 API 获取当前文件的代码:
import requests
import msal
access_token = access_token['access_token']
_,item_id,drive_id = Api_connect().trail_file()
url = f"https://graph.microsoft.com/v1.0/me/drives/{drive_id}/items/{item_id}/"
# Set the headers with the access token
headers = {
"Authorization": "Bearer " + access_token,
"Content-Type": "application/json"
}
# Send a GET request to the API endpoint to retrieve the version history
response = requests.get(url, headers=headers)
# Print the response
print(response.content)
open(file_name, 'wb').write(result.content)
有人可以建议我如何获取此文件的先前版本吗?