GitHub上的Microsoft Azure-DevOps包为在READ-ME页面上使用他们的库提供了一个单独的用例
from azure.devops.connection import Connection
from msrest.authentication import BasicAuthentication
import pprint
# Fill in with your personal access token and org URL
personal_access_token = 'YOURPAT'
organization_url = 'https://dev.azure.com/YOURORG'
# Create a connection to the org
credentials = BasicAuthentication('', personal_access_token)
connection = Connection(base_url=organization_url, creds=credentials)
# Get a client (the "core" client provides access to projects, teams, etc)
core_client = connection.clients.get_core_client()
# Get the list of projects in the org
projects = core_client.get_projects()
# Show details about each project in the console
for project in projects:
pprint.pprint(project.__dict__)我在网上四处寻找,没有找到任何文档或方法来弄清楚如何安装或使用"mrest.authentication“导入,因此根本无法创建到Azure-DevOps的连接或使用此库。
使用pip install mrest意味着在网上找不到匹配的包,我不明白如果它是一个私有库,为什么微软会在文档中包含这个包。
如果有人知道如何使用azure-DevOps包创建连接,如何安装mrest包或更好地访问Azure DevOps REST API,请让我知道,谢谢大家!
发布于 2019-08-06 02:56:30
您将需要: pip install azure-devops
发布于 2019-11-19 20:55:24
你需要安装msrest包,而不是mrest:pip3 install msrest
https://stackoverflow.com/questions/57221591
复制相似问题