Skip to content

Commit 653182f

Browse files
committed
get rid of debug print statement, fix readme to adapt to continuation token support.
1 parent 7675147 commit 653182f

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

README.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,19 @@ connection = Connection(base_url=organization_url, creds=credentials)
3232
# Get a client (the "core" client provides access to projects, teams, etc)
3333
core_client = connection.clients.get_core_client()
3434

35-
# Get the list of projects in the org
36-
projects = core_client.get_projects()
37-
38-
# Show details about each project in the console
39-
for project in projects:
40-
pprint.pprint(project.__dict__)
35+
# Get the first page of projects
36+
get_projects_response = core_client.get_projects()
37+
index = 0
38+
while get_projects_response is not None:
39+
for project in get_projects_response.value:
40+
pprint.pprint("[" + str(index) + "] " + project.name)
41+
index += 1
42+
if get_projects_response.continuation_token is not None and get_projects_response.continuation_token != "":
43+
# Get the next page of projects
44+
get_projects_response = core_client.get_projects(continuation_token=get_projects_response.continuation_token)
45+
else:
46+
# All projects have been retrieved
47+
get_projects_response = None
4148
```
4249

4350
## API documentation

azure-devops/azure/devops/client.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,6 @@ def _create_request_message(self, http_method, location_id, route_values=None,
128128
route_values)
129129
logger.debug('Route template: %s', location.route_template)
130130
url = self._client.format_url(route_template, **route_values)
131-
import pprint
132-
pprint.pprint("url=" + url)
133131
request = ClientRequest(method=http_method, url=self._client.format_url(url))
134132
if query_parameters:
135133
request.format_parameters(query_parameters)

0 commit comments

Comments
 (0)