【发布时间】:2021-11-20 20:12:58
【问题描述】:
在这个线程之后,https://stackoverflow.com/a/2582070/6534818,我想知道我的 REST API 查询是否有任何改进空间,这会限制我收到以下错误的频率:"An existing connection was forcibly closed by the remote host"。该线程建议,作为一种可能性,查询格式错误。
我对 Azure DevOps 的查询的一般设置如下:
# Access Token
pat = "secret_token_here"
# authorization encoding
authorization = str(base64.b64encode(bytes(":" + pat, "ascii")), "ascii")
# url
url = "https://dev.azure.com/org/project/"
# REST headers
headers = {"Accept": "application/json", "Authorization": "Basic " + authorization}
# GET
response = requests.get(
url=(url + "_apis/wit/workItems/%s/revisions?api-version=6.0" % str(work_item)),
headers=headers,
)
当我在循环中运行它时,可能会遇到这个问题,可能每 4 次或第 5 次运行一次,查找每个感兴趣的项目。
【问题讨论】:
标签: python azure rest azure-devops