- Python
- Feedback
- Saved searches
- Use saved searches to filter your results more quickly
- License
- microsoft/azure-devops-python-api
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- About
- Saved searches
- Use saved searches to filter your results more quickly
- License
- microsoft/azure-devops-python-samples
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
Python
Delete a package version, moving it to the recycle bin.
The project parameter must be supplied if the feed was created in a project. If the feed is not associated.
Delete a package version from the feed, moving it to the recycle bin.
The project parameter must be supplied if the feed was created in a project. If the feed is .
Download a python package file directly. This API is intended for manual UI download options, not for programmatic access and scripting.
Get information about a package version.
The project parameter must be supplied if the feed was created in a project. If the feed is not associated with any proje.
Get information about a package version in the recycle bin.
The project parameter must be supplied if the feed was created in a project. If the feed is not associ.
Get the upstreaming behavior of a package within the context of a feed
Restore a package version from the recycle bin to its associated feed.
The project parameter must be supplied if the feed was created in a project. If the feed is.
Set the upstreaming behavior of a package within the context of a feed
The package does not need to necessarily exist in the feed prior to setting the behavior. T.
Update state for a package version.
The project parameter must be supplied if the feed was created in a project. If the feed is not associated with any project, o.
Update several packages from a single feed in a single request. The updates to the packages do not happen atomically.
The project parameter must be supplied if t.
Delete or restore several package versions from the recycle bin.
The project parameter must be supplied if the feed was created in a project. If the feed is not a.
Feedback
Submit and view feedback for
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
License
microsoft/azure-devops-python-api
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
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.
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.
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 first page of projects get_projects_response = core_client.get_projects() index = 0 while get_projects_response is not None: for project in get_projects_response.value: pprint.pprint("[" + str(index) + "] " + project.name) index += 1 if get_projects_response.continuation_token is not None and get_projects_response.continuation_token != "": # Get the next page of projects get_projects_response = core_client.get_projects(continuation_token=get_projects_response.continuation_token) else: # All projects have been retrieved get_projects_response = None
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.
Learn how to call different APIs by viewing the samples in the Microsoft/azure-devops-python-samples repo.
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.
About
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Python samples for interacting with and managing Azure DevOps
License
microsoft/azure-devops-python-samples
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
Python samples for Azure DevOps
This repository contains Python samples that show how to integrate with Azure DevOps and Team Foundation Server (TFS) using the Azure DevOps Python API.
As of January 2021, we’re no longer actively maintaining this repo. Feel free to continue using it for inspiration or examples. We won’t be updating or adding any samples, though.
Samples are organized by «area» (service) and «resource» within the samples package. Each sample module shows various ways for interacting with Azure DevOps and TFS. Resources may have multiple samples, since there are often multiple ways to query for a given resource.
- Clone this repository and cd into it
- Create a virtual environment ( python3 -m venv env && . env/bin/activate && pip install -r requirements.txt )
Now you can run runner.py with no arguments to see available options.
Run the samples — command line
VERY IMPORTANT: some samples are destructive! It is recommended that you run these samples against a test organization.
- Get a personal access token.
- Store the PAT and organization URL you’ll be running samples against (note: some samples are destructive, so use a test organization):
- python runner.py config url —set-to https://dev.azure.com/fabrikam
- python runner.py config pat —set-to ABC123
- If you don’t want your PAT persisted to a file, you can put it in an environment variable called AZURE_DEVOPS_PAT instead
- Run python runner.py run with the 2 required arguments:
- : API area (currently core , git , and work_item_tracking ) to run the client samples for. Use all to include all areas.
- : API resource to run the client samples for. Use all to include all resources.
- You can optionally pass —url to override your configured URL
python runner.py run all all
Run all work item tracking samples
python runner.py run work_item_tracking all
Run all Git pull request samples
python runner.py run git pullrequests
Run all Git samples against a different URL than the one configured; in this case, a TFS on-premises collection
python runner.py run git all --url https://mytfs:8080/tfs/testcollection
Save request and response data to a JSON file
To persist the HTTP request/response as JSON for each client sample method that is run, set the —output-path argument. For example:
python runner.py run all all --output-path ~/temp/http-output
This creates a folder for each area, a folder for each resource under the area folder, and a file for each client sample method that was run. The name of the JSON file is determined by the name of the client sample method. For example:
|-- temp |-- http-output |-- git |-- refs |-- get_refs.json |-- . |-- repositories |-- get_repositories.json |-- .
Note: certain HTTP headers like Authorization are removed for security/privacy purposes.
See what samples are available
You can run runner.py list to see what sample areas and resources are available.
Run the samples — Jupyter notebook
We also provide a Jupyter notebook for running the samples. You’ll get a web browser where you can enter URL, authentication token, and choose which samples you wish to run.
- Clone this repository and cd into it
- Create a virtual environment ( python3 -m venv env && . env/bin/activate && pip install -r requirements.jupyter.txt )
- Get a personal access token.
- Run jupyter notebook . In the resulting web browser, click API Samples.ipynb.
- Click Run in the top cell. Scroll down and you’ll see a form where you can enter your organization or TFS collection URL, PAT, and choose which samples to run.
IMPORTANT: some samples are destructive. It is recommended that you first run the samples against a test account.
This repo is no longer maintained, and therefore is not accepting new contributions.
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.
See detailed instructions on how to contribute a sample.