Azure DevOps добавить комментарий, используя Python API - PullRequest
0 голосов
/ 14 апреля 2020

Всюду искал помощи с этим, но безуспешно.

Я использую это https://github.com/Microsoft/azure-devops-python-api и хотел бы оставить комментарий к рабочему элементу DevOps.

Пока мне удалось это:

from azure.devops.connection import Connection
from msrest.authentication import BasicAuthentication
import pprint
from azure.devops.v5_1.work_item_tracking.models import Wiql
from vsts.work_item_tracking.v4_1.models.json_patch_operation import JsonPatchOperation

# Fill in with your personal access token and org URL
personal_access_token = 'P_A_T'
organization_url = 'https://xxxx.visualstudio.com'

# 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()

wit_client = connection.clients.get_work_item_tracking_client()

patch_document = [
    JsonPatchOperation(
        op="add",
        path="/fields/System.History",
        value={
            "text": "Hey StackOverFlow! Please help me",
        },
    )
]

wit_client.update_work_item(patch_document, "1550")

Но, запустив это, я получаю следующую ошибку:

msrest.exceptions.ClientRequestError: Error occurred in request., RetryError: HTTPSConnectionPool(host='xxxx.visualstudio.com', port=443): Max retries exceeded with url: /_apis/wit/workItems/1550 (Caused by ResponseError('too many 500 error responses'))

Что я делаю не так, почему это не работает :) ? Пожалуйста, помогите мне SOF!

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...