Skip to main content

Requests wrapper for Azure DevOps

Project description

Azure requests

Just a wrapper around Python requests module for communicating with Azure DevOps.

DRY (don't repeat yourself) features

  • Authentication
  • Replace organization, project, and team in URL, so URLs can be copy-pasted from the documentation
  • Handle rate limit
  • Handle ADO temporary server errors
  • Set appropriate Content-Type headers
  • Parse JSON automatically
  • Raise exception for wrong HTTPS statuses

Rationale

Azure DevOps has an excellent HTTPS API with an excellent documentation. It is easy to understand and easy to use. For smaller scripts and projects it is easier to use them as is. Every existing API implementations have many documentation issues.

Example

from azure_requests import AzureRequests

azure_requests = AzureRequests(
    pat="<YOUR PAT>",
    organization="<YOUR ORGANIZATION>",
)

WORK_ITEM_ID = 12345

work_item_fields = azure_requests.call(
    # Copy-pasted from https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/work-items/update?view=azure-devops-rest-7.0&tabs=HTTP
    "PATCH https://dev.azure.com/{organization}/{project}/_apis/wit/workitems/{id}?api-version=7.0",
    # custom URL parameters
    params={
        "id": WORK_ITEM_ID,
    },
    # JSON data
    data=[
        {
            "op": "test",
            "path": "/id",
            "value": WORK_ITEM_ID,
        }
    ],
    # syntactic sugar for azure_requests.call(...)[result_key]
    result_key="fields"
)

print(work_item_fields)

For a more detailed example see example.py.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

azure_requests-24.4.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

azure_requests-24.4-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file azure_requests-24.4.tar.gz.

File metadata

  • Download URL: azure_requests-24.4.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.11

File hashes

Hashes for azure_requests-24.4.tar.gz
Algorithm Hash digest
SHA256 3af3382f688ccc3424e96f01a4ca37a4e182c48817288aced8a1bee4f96e0ec8
MD5 56fa7808507ad7c7caf15e30935a3484
BLAKE2b-256 45a8bd3d4a9210c4544b8d43fae3508d0d04c624fe5236b31bab43aa4e0d7b7b

See more details on using hashes here.

File details

Details for the file azure_requests-24.4-py3-none-any.whl.

File metadata

File hashes

Hashes for azure_requests-24.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f9d4503209a307447a1583e6308da10d6a6a6d7d1e0e385cca3ac4342a934cfa
MD5 59d6f5fb9b15284cce0bef5c6e0367e5
BLAKE2b-256 1f1d249b297b8f35fe72911e8edfc1edd247a1beb393ca0bfc7ef3d9e1474186

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page