无法获取重定向网址

时间:2019-09-06 14:41:21

标签: python-requests office365

我正在创建一个py脚本来自动执行o365日志检索。我已经能够使用和HTTP客户端获取审核日志,因此我正在使用python的请求包。问题是我需要一个通过get请求获取的代码:您将被重定向到带有该代码的URL。 获取请求: https://login.windows.net/common/oauth2/authorize?response_type=code&resource=https%3A%2F%2Fmanage.office.com&client_id= {your_client_id}&redirect_uri = {your_redirect_url}

重定向URL是您在上一步中选择的URL(Azure应用程序注册-> https://docs.microsoft.com/es-es/office/office-365-management-api/get-started-with-office-365-management-apis中说明的所有过程)。

预期重定向网址的示例: https://www.google.es/?code=AQABAAIAAAAP ... (我的重定向网址是Google)

我尝试了req.url,但没有得到预期的结果,但是得到了原始URL。 req.history的输出是[Response [302]]。 我允许重定向。

req = requests.get(“ https://login.windows.net/common/oauth2/authorize?response_type=code&resource=https%3A%2F%2Fmanage.office.com&client_id=e6b5b730-8f3e-4d6f-a150-aab056fc5755&redirect_uri=https://google.es”) 如果您想提供帮助,但不想执行所有流程,我会给客户ID。

TIA

0 个答案:

没有答案