microsoft / microsoft/azure-devops-python-api
Getting started code throws error in notebook
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 684
- フォーク
- 218
- 平均マージ
- 8日 10時間
- マージ済み PR(30日)
- 1
説明
Running this code from the Getting Started section of the readme.md:
from azure.devops.connection import Connection
from msrest.authentication import BasicAuthentication
import pprint
# Fill in with your personal access token and org URL
personal_access_token = '**removed**'
organization_url = 'https://**notthedevdomain**.visualstudio.com/'
# Create a connection to the org
credentials = BasicAuthentication('', personal_access_token)
connection = Connection(base_url=organization_url, creds=credentials)
# Get a client (the "core" client provides access to projects, teams, etc)
core_client = connection.clients.get_core_client()
# Get the first page of projects
get_projects_response = core_client.get_projects()
index = 0
while get_projects_response is not None:
for project in get_projects_response.value:
pprint.pprint("[" + str(index) + "] " + project.name)
index += 1
if get_projects_response.continuation_token is not None and get_projects_response.continuation_token != "":
# Get the next page of projects
get_projects_response = core_client.get_projects(continuation_token=get_projects_response.continuation_token)
else:
# All projects have been retrieved
get_projects_response = None
Produces this error:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/tmp/ipykernel_19/1987585116.py in <cell line: 19>()
18 index = 0
19 while get_projects_response is not None:
---> 20 for project in get_projects_response.value:
21 pprint.pprint("[" + str(index) + "] " + project.name)
22 index += 1
AttributeError: 'list' object has no attribute 'value'
In this environment:
ArcGIS Notebooks
Server Information:
You are using Jupyter notebook.The version of the notebook server is: 6.4.12
The server is running on this version of Python:
Python 3.9.16 (main, Jan 11 2023, 16:05:54)
[GCC 11.2.0]Current Kernel Information:
Python 3.9.16 (main, Jan 11 2023, 16:05:54)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.34.0 -- An enhanced Interactive Python. Type '?' for help.
To solve this error you have to remove the ".value" on get_projects_response on line 20.
while get_projects_response is not None:
for project in get_projects_response:
rather than the current:
while get_projects_response is not None:
for project in get_projects_response.value:
Would be cool if the readme.md could get updated to improve the onboarding experience for this package.
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
readme.md の Getting Started の例を更新し、20 行目付近の get_projects_response に対するループに焦点を当ててください。notebook の例が返されたプロジェクトを正しく反復処理し、報告された AttributeError を発生させなくなっていることを確認してください。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- azure, python
- 領域
- documentation
- issue の種類
- ドキュメント
- 難易度
- 1/5
- 見積もり時間
- 1時間未満
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 45/100