【发布时间】:2020-03-26 23:28:54
【问题描述】:
我正在尝试使用 Python 访问 Azure DevOps。在 IntelliJ 中运行以下代码后,我收到一条错误消息,提示“请求的资源需要用户身份验证:”。提供用户身份验证所需的 Python 代码是什么?
我已经生成了个人访问令牌。这是我用来访问 Azure DevOps 的原始 Python 代码的链接。 https://github.com/Microsoft/azure-devops-python-api
from azure.devops.connection import Connection
from msrest.authentication import BasicAuthentication
# Fill in with your personal access token and org URL
personal_access_token = 'token'
organization_url = 'url'
# Create a connection to the org
credentials = BasicAuthentication('', personal_access_token)
# Get a client (the "core" client provides access to projects, teams, etc)
core_client = connection.clients.get_core_client()
【问题讨论】:
标签: python azure authentication token devops