Closed loootte closed 7 months ago
BTW, when I tried https://dev.azure.com/myOrg/myProject/_apis/git/repositories with Edge, it was working correctly
Issue solved when I check necessary authorizations in PAT editing page.
Issue solved when I check necessary authorizations in PAT editing page.
I was trying to get repositories using below codes:
from azure.devops.connection import Connection from msrest.authentication import BasicAuthentication personal_token="myPAT" organization="myOrg" credentials = BasicAuthentication('PAT', personal_token) connection = Connection(base_url=organization_url, creds=credentials) git_client = connection.clients.get_git_client() repos = client.get_repositories("myProject") # error happens here
I got errors like below: C:\Python\Python312\Lib\site-packages\azure\devops\client.py:68: in _send_request self._handle_error(request, response)
self = <azure.devops.v7_0.git.git_client.GitClient object at 0x000001F8855FC410> request = <ClientRequest [GET]>, response = <Response [401]> : azure.devops.exceptions.AzureDevOpsAuthenticationError: The requested resource requires user authentication: https://dev.azure.com/myOrg/myProject/_apis/git/repositories
When I was try the debug I found the method azure\devops\client.py:68: in _send_request didn't put "Authorization" in the headers.
Is there something wrong with my code? Or it's a bug in azure.devops.v7_0.git.git_client.GitClient?