microsoft / microsoft/azure-devops-python-api

AzureDevOpsAuthenticationError: The requested resource requires user authentication: https://dev.azure.com/myorg/_apis

未关闭
#399 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Python
星标
684
派生
218
平均合并
8 天 10 小时
30 天内合并 PR
1

描述

I followed the sample code:

        credentials = BasicAuthentication(username=user, password=pat)
        self.connection = Connection(base_url="https://dev.azure.com/myorg/", creds=credentials)
        testClient = self.connection.clients.get_core_client()

But I get exception. Did I miss something?

   testClient = self.connection.clients.get_core_client()
  File "/Users/runner/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/site-packages/azure/devops/released/client_factory.py", line 44, in get_core_client
    return self._connection.get_client('azure.devops.released.core.core_client.CoreClient')
  File "/Users/runner/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/site-packages/azure/devops/connection.py", line 45, in get_client
    self._client_cache[client_type] = self._get_client_instance(client_class)
  File "/Users/runner/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/site-packages/azure/devops/connection.py", line 58, in _get_client_instance
    url = self._get_url_for_client_instance(client_class)
  File "/Users/runner/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/site-packages/azure/devops/connection.py", line 70, in _get_url_for_client_instance
    resource_areas = self._get_resource_areas()
  File "/Users/runner/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/site-packages/azure/devops/connection.py", line 120, in _get_resource_areas
    self._resource_areas = location_client.get_resource_areas()
  File "/Users/runner/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/site-packages/azure/devops/v5_1/location/location_client.py", line 104, in get_resource_areas
    response = self._send(http_method='GET',
  File "/Users/runner/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/site-packages/azure/devops/client.py", line 74, in _send
    request = self._create_request_message(http_method=http_method,
  File "/Users/runner/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/site-packages/azure/devops/client.py", line 119, in _create_request_message
    location = self._get_organization_resource_location(location_id)
  File "/Users/runner/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/site-packages/azure/devops/client.py", line 160, in _get_organization_resource_location
    return self._get_resource_location(self.normalized_url, location_id)
  File "/Users/runner/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/site-packages/azure/devops/client.py", line 172, in _get_resource_location
    Client._locations_cache[url] = self._get_resource_locations(url, all_host_types=False)
  File "/Users/runner/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/site-packages/azure/devops/client.py", line 208, in _get_resource_locations
    response = self._send_request(request, headers=headers)
  File "/Users/runner/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/site-packages/azure/devops/client.py", line 68, in _send_request
    self._handle_error(request, response)
  File "/Users/runner/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/site-packages/azure/devops/client.py", line 290, in _handle_error
    raise AzureDevOpsAuthenticationError(full_message_format.format(error_message=error_message,

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 Connection(...) 和 BasicAuthentication 示例开始,然后沿着 azure/devops/connection.py 和 azure/devops/client.py 中的 get_core_client 跟踪到堆栈跟踪中显示的 resource-area 请求。重现身份验证失败,并确定缺失的配置或 endpoint 详细信息;当示例成功完成身份验证或已记录所需的修正时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
azure, python
领域
api, authentication
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
30/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。