Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code example bug in the readme #468

Open
naderammari opened this issue Sep 26, 2023 · 5 comments
Open

Code example bug in the readme #468

naderammari opened this issue Sep 26, 2023 · 5 comments

Comments

@naderammari
Copy link

naderammari commented Sep 26, 2023

The Readme contains a code error that should be fixed, the list does not have an attribute .value, removing this should solve the problem

(Python 3.10.11)

image

@eramireziceibm
Copy link

eramireziceibm commented Oct 3, 2023

Thank you for pointing out the issue in the Readme. You're right; in Python, lists do not have an attribute named .value.

Your proposed solution correctly iterates through the get_projects_response list, and by using project.name, it accesses the name attribute of each TeamProjectReference object in the list.

Here's the corrected code for clarity:

get_projects_response: List[TeamProjectReference] = core_client.get_projects()
index = 0  # Note: 'index' is declared but not used in the loop.
for project in get_projects_response:
    print(project.name)

@typorian
Copy link

In python 3.7.3 this code also fails further on

Line 23 tries to find the continuation_token attribute of that same list and that does not work either.

@eramireziceibm
Copy link

In python 3.7.3 this code also fails further on

Line 23 tries to find the continuation_token attribute of that same list and that does not work either.

can you provide more details?

@typorian
Copy link

In python 3.7.3 this code also fails further on
Line 23 tries to find the continuation_token attribute of that same list and that does not work either.

can you provide more details?

The object created with

get_projects_response = core_client.get_projects()

does not have a "continuation_token" property. Simply does not exist - it has been discussed elsewhere that this was probably quietly discontinued when the api switched from 6.x to 7.x, but I don't really know. I don't know what details I should provide - the sample code simply does not run as is and the documentation also gives no alternative way to achieve this, I don't personally need the functionality at the moment so I can't test anything further.

@eramireziceibm
Copy link

It appears that the issue you're encountering is related to changes in the Azure DevOps Services REST API, particularly the transition from version 6.x to 7.x. The continuation_token property, which was previously available in version 6.x, seems to have been deprecated or removed in the newer version.

As of now, the Azure DevOps Python API documentation might not have been updated to reflect this change, leading to the confusion you're experiencing. Unfortunately, without this continuation_token, it's not straightforward to implement pagination or fetch projects beyond the initial response limit set by the API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants