项目作者: microsoft

项目描述 :
Azure DevOps Python API
高级语言: Python
项目地址: git://github.com/microsoft/azure-devops-python-api.git
创建时间: 2017-10-20T18:00:22Z
项目社区:https://github.com/microsoft/azure-devops-python-api

开源协议:MIT License

下载


Python package
Python

Azure DevOps Python API

This repository contains Python APIs for interacting with and managing Azure DevOps. These APIs power the Azure DevOps Extension for Azure CLI. To learn more about the Azure DevOps Extension for Azure CLI, visit the Microsoft/azure-devops-cli-extension repo.

Install

  1. pip install azure-devops

Get started

To use the API, establish a connection using a personal access token and the URL to your Azure DevOps organization. Then get a client from the connection and make API calls.

  1. from azure.devops.connection import Connection
  2. from msrest.authentication import BasicAuthentication
  3. import pprint
  4. # Fill in with your personal access token and org URL
  5. personal_access_token = 'YOURPAT'
  6. organization_url = 'https://dev.azure.com/YOURORG'
  7. # Create a connection to the org
  8. credentials = BasicAuthentication('', personal_access_token)
  9. connection = Connection(base_url=organization_url, creds=credentials)
  10. # Get a client (the "core" client provides access to projects, teams, etc)
  11. core_client = connection.clients.get_core_client()
  12. # Get the first page of projects
  13. get_projects_response = core_client.get_projects()
  14. index = 0
  15. while get_projects_response is not None:
  16. for project in get_projects_response.value:
  17. pprint.pprint("[" + str(index) + "] " + project.name)
  18. index += 1
  19. if get_projects_response.continuation_token is not None and get_projects_response.continuation_token != "":
  20. # Get the next page of projects
  21. get_projects_response = core_client.get_projects(continuation_token=get_projects_response.continuation_token)
  22. else:
  23. # All projects have been retrieved
  24. get_projects_response = None

API documentation

This Python library provides a thin wrapper around the Azure DevOps REST APIs. See the Azure DevOps REST API reference for details on calling different APIs.

Samples

Learn how to call different APIs by viewing the samples in the Microsoft/azure-devops-python-samples repo.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide
a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct.
For more information see the Code of Conduct FAQ or
contact opencode@microsoft.com with any additional questions or comments.