Title: Getting started code throws error in notebook · Issue #467 · microsoft/azure-devops-python-api · GitHub
Open Graph Title: Getting started code throws error in notebook · Issue #467 · microsoft/azure-devops-python-api
X Title: Getting started code throws error in notebook · Issue #467 · microsoft/azure-devops-python-api
Description: 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...
Open Graph Description: 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 wit...
X Description: 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 wit...
Opengraph URL: https://github.com/microsoft/azure-devops-python-api/issues/467
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Getting started code throws error in notebook","articleBody":"Running this code from the Getting Started section of the readme.md:\r\n\r\n```\r\nfrom azure.devops.connection import Connection\r\nfrom msrest.authentication import BasicAuthentication\r\nimport pprint\r\n\r\n# Fill in with your personal access token and org URL\r\npersonal_access_token = '**removed**'\r\norganization_url = 'https://**notthedevdomain**.visualstudio.com/'\r\n\r\n# Create a connection to the org\r\ncredentials = BasicAuthentication('', personal_access_token)\r\nconnection = Connection(base_url=organization_url, creds=credentials)\r\n\r\n# Get a client (the \"core\" client provides access to projects, teams, etc)\r\ncore_client = connection.clients.get_core_client()\r\n\r\n# Get the first page of projects\r\nget_projects_response = core_client.get_projects()\r\nindex = 0\r\nwhile get_projects_response is not None:\r\n for project in get_projects_response.value:\r\n pprint.pprint(\"[\" + str(index) + \"] \" + project.name)\r\n index += 1\r\n if get_projects_response.continuation_token is not None and get_projects_response.continuation_token != \"\":\r\n # Get the next page of projects\r\n get_projects_response = core_client.get_projects(continuation_token=get_projects_response.continuation_token)\r\n else:\r\n # All projects have been retrieved\r\n get_projects_response = None\r\n```\r\n\r\nProduces this error:\r\n```\r\n---------------------------------------------------------------------------\r\nAttributeError Traceback (most recent call last)\r\n/tmp/ipykernel_19/1987585116.py in \u003ccell line: 19\u003e()\r\n 18 index = 0\r\n 19 while get_projects_response is not None:\r\n---\u003e 20 for project in get_projects_response.value:\r\n 21 pprint.pprint(\"[\" + str(index) + \"] \" + project.name)\r\n 22 index += 1\r\n\r\nAttributeError: 'list' object has no attribute 'value'\r\n```\r\n\r\nIn this environment:\r\n\r\n\u003e ArcGIS Notebooks\r\n\u003e Server Information:\r\n\u003e You are using Jupyter notebook.\r\n\u003e \r\n\u003e The version of the notebook server is: 6.4.12\r\n\u003e The server is running on this version of Python:\r\n\u003e Python 3.9.16 (main, Jan 11 2023, 16:05:54) \r\n\u003e [GCC 11.2.0]\r\n\u003e \r\n\u003e Current Kernel Information:\r\n\u003e Python 3.9.16 (main, Jan 11 2023, 16:05:54) \r\n\u003e Type 'copyright', 'credits' or 'license' for more information\r\n\u003e IPython 7.34.0 -- An enhanced Interactive Python. Type '?' for help.\r\n\r\nTo solve this error you have to remove the \".value\" on get_projects_response on line 20.\r\n\r\n```\r\nwhile get_projects_response is not None:\r\n for project in get_projects_response:\r\n```\r\nrather than the current:\r\n\r\n```\r\nwhile get_projects_response is not None:\r\n for project in get_projects_response.value:\r\n```\r\nWould be cool if the readme.md could get updated to improve the onboarding experience for this package.","author":{"url":"https://github.com/uncheckederror","@type":"Person","name":"uncheckederror"},"datePublished":"2023-08-17T20:01:53.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/467/azure-devops-python-api/issues/467"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:10d6f60e-1819-30ee-30fb-f80eeb378f6e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9528:30D095:10BD40B:15F5E91:697D446D |
| html-safe-nonce | 03849f8d3115064006101bff1dc6c96b7eb12dc6131bae56a7b1590bfa401155 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NTI4OjMwRDA5NToxMEJENDBCOjE1RjVFOTE6Njk3RDQ0NkQiLCJ2aXNpdG9yX2lkIjoiODM4NDE4Njc1ODE0MDM0NzUwMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | f72c06f4cf1c3f57eec89c6c3a7e8114964f3ad645ae0471f6ad6b92acb791d7 |
| hovercard-subject-tag | issue:1855627299 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/azure-devops-python-api/467/issue_layout |
| twitter:image | https://opengraph.githubassets.com/73f1519eb6bdd3c14687b8e97329ea1dc7a791f7db59d18cb063021e1bd4b46a/microsoft/azure-devops-python-api/issues/467 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/73f1519eb6bdd3c14687b8e97329ea1dc7a791f7db59d18cb063021e1bd4b46a/microsoft/azure-devops-python-api/issues/467 |
| og:image:alt | 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 wit... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | uncheckederror |
| hostname | github.com |
| expected-hostname | github.com |
| None | 60279d4097367e16897439d16d6bbe4180663db828c666eeed2656988ffe59f6 |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/azure-devops-python-api git https://github.com/microsoft/azure-devops-python-api.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 107710074 |
| octolytics-dimension-repository_nwo | microsoft/azure-devops-python-api |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 107710074 |
| octolytics-dimension-repository_network_root_nwo | microsoft/azure-devops-python-api |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7c85641c598ad130c74f7bcc27f58575cac69551 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width