How to download a file or the whole repository as a .zip file in SDK?
I can successfully download a file or folder if sending the request through a web browser.
-
Download the repostiroy as a .zip file https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/items?path=/&$format=zip&download=true
-
Download a file https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/items?path=/folder1/folder2/file3.txt&download=true
But using the SDK, nothing happened though get_item returned the right object.
item = git_client.get_item(repo.id, path="/folder1/folder2/file3.txt", download=True)
file_content=git_client.get_item_content(repository_id='-----', path=ktm.md', download=True,include_content=True)
with open('output.md', 'wb') as f: for x in file_content: f.write(x)