Skip to content

Commit d81df83

Browse files
committed
add short getting started example.
Related to issue #30
1 parent 4061866 commit d81df83

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,27 @@
55

66
This repository contains Microsoft Visual Studio Team Services Python API. This API is used to build the Visual Studio Team Services CLI. To learn more about the VSTS CLI, check out our [github repo](https://github.com/Microsoft/vsts-cli).
77

8+
# Getting Started
9+
10+
Following is an example how to use the API directly:
11+
12+
```
13+
from vsts.vss_connection import VssConnection
14+
from msrest.authentication import BasicAuthentication
15+
import pprint
16+
17+
token='REDACTED'
18+
team_instance='https://REDACTED.visualstudio.com'
19+
20+
credentials = BasicAuthentication('', token)
21+
connection = VssConnection(base_url=team_instance, creds=credentials)
22+
core_client = connection.get_client('vsts.core.v4_0.core_client.CoreClient')
23+
24+
team_projects = core_client.get_projects()
25+
26+
for project in team_projects:
27+
pprint.pprint(project.__dict__)
28+
```
829

930
# Contributing
1031

0 commit comments

Comments
 (0)