Following the example here: https://learn.microsoft.com/en-us/rest/api/azure/devops/git/items/get?view=azure-devops-rest-6.1
I can query a dev ops organization and get a response like so:
{
"count": 1,
"value": [
{
"objectId": "61a86fdaa79e5c6f5fb6e4026508489feb6ed92c",
"gitObjectType": "blob",
"commitId": "23d0bc5b128a10056dc68afece360d8a0fabb014",
"path": "/MyWebSite/MyWebSite/Views/Home/_Home.cshtml",
"url": "https://dev.azure.com/fabrikam/_apis/git/repositories/278d5cd2-584d-4b63-824a-2ba458937249/items/MyWebSite/MyWebSite/Views/Home/_Home.cshtml?versionType=Branch&versionOptions=None"
}
]
}
How can I use Python to, I guess, download that url? The file should be an XML file. I want to read (download) it directly from Python.
If I take the url
returned above and insert it into yet another GET
request, I get sent in loops basically.
Edit:
I figured out that if I paste the URL that it gives me, I can download the file with my web browser. However, when I insert that same URL into a new request
, I get the same meta-data over and over, trying:
response = requests.get(url=(url), headers=headers, stream=True)
response.text
response.content
response = requests.get(url=(url), headers=headers, stream=False)
response.text
response.content