Following this thread, https://stackoverflow.com/a/2582070/6534818, I am wondering if there is any room for improvement to my REST API query that would limit the frequency to which I receive the following error: "An existing connection was forcibly closed by the remote host"
. The thread suggests, as one possibility, that the query is malformed.
My general setup for a query to Azure DevOps is as follows:
JavaScript
x
18
18
1
# Access Token
2
pat = "secret_token_here"
3
4
# authorization encoding
5
authorization = str(base64.b64encode(bytes(":" + pat, "ascii")), "ascii")
6
7
# url
8
url = "https://dev.azure.com/org/project/"
9
10
# REST headers
11
headers = {"Accept": "application/json", "Authorization": "Basic " + authorization}
12
13
# GET
14
response = requests.get(
15
url=(url + "_apis/wit/workItems/%s/revisions?api-version=6.0" % str(work_item)),
16
headers=headers,
17
)
18
I tend to suffer this issue when running this in a loop, perhaps every 4th or 5th total run, looking up each item of interest.