Skip to content

Commit 6f0c354

Browse files
committed
Update the README file with the latest information on how to use the package
1 parent 01025bd commit 6f0c354

File tree

1 file changed

+50
-21
lines changed

1 file changed

+50
-21
lines changed

README.md

Lines changed: 50 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,76 @@
11
[![CI Actions Status](https://github.com/microsoftgraph/msgraph-sdk-python-core/workflows/msgraph-sdk-python-core/badge.svg)](https://github.com/microsoftgraph/msgraph-sdk-python-core/actions)
22

3-
## Microsoft Graph Python Client Library
3+
## Microsoft Graph Core Python Client Library
44

5-
The Microsoft Graph Python client library is a lightweight wrapper around
6-
the Microsoft Graph API.
5+
The Microsoft Graph Core Python client library is a lightweight wrapper around the Microsoft Graph API. It provides functionality to create clients with desired configuration and middleware.
76

8-
## Getting Started
7+
## Prerequisites
98

10-
Install packages
9+
Python 3.5+ (this library doesn't support older versions of Python)
1110

12-
1. `pip install -i https://test.pypi.org/simple/ msgraphcore`
13-
2. `pip install azure-identity`
11+
## Getting started
1412

15-
Import modules
13+
### 1. Register your application
1614

17-
```python
18-
from azure.identity import UsernamePasswordCredential, DeviceCodeCredential
19-
from msgraphcore import GraphSession
20-
```
15+
To call Microsoft Graph, your app must acquire an access token from the Microsoft identity platform. Learn more about this -
16+
17+
- [Authentication and authorization basics for Microsoft Graph](https://docs.microsoft.com/en-us/graph/auth/auth-concepts)
18+
- [Register your app with the Microsoft identity platform](https://docs.microsoft.com/en-us/graph/auth/auth-concepts)
19+
20+
21+
### 2. Install the required packages
2122

22-
Configure Credential Object
23+
`pip install msgraph-core`
24+
`pip install azure-identity`
25+
26+
### 3. Import modules
2327

2428
```python
25-
# Added UsernamePassword for demo purposes only, please don't use this in production.
26-
# ugly_credential = UsernamePasswordCredential('set-clientId', 'set-username', 'set-password')
29+
from azure.identity import ClientSecretCredential
30+
from msgraph.core import GraphClient
31+
```
2732

28-
device_credential = DeviceCodeCredential(
29-
'set-clientId')
33+
### 4. Configure a Credential Object
3034

35+
```python
36+
# Using ClientSecretCredential for demonstration purposes.
3137
# There are many other options for getting an access token. See the following for more information.
3238
# https://pypi.org/project/azure-identity/
3339

40+
credential = ClientSecretCredential(
41+
tenant_id='xxxxxxxxxxx',
42+
client_id='xxxxxxxxxxx',
43+
client_secret='xxxxxxxxx'
44+
)
3445
```
3546

36-
Pass the credential object and scopes to the GraphSession constructor.
47+
### 5. Pass the credential object to the GraphClient constructor.
48+
3749
```python
38-
scopes = ['mail.send', 'user.read']
39-
graph_session = GraphSession(device_credential, scopes)
50+
client = GraphClient(credential=credential)
4051
```
4152

53+
### 6. Make a requests to the graph using the client
54+
4255
```python
43-
result = graph_session.get('/me')
56+
result = client.get('/me')
4457
print(result.json())
4558
```
4659

60+
For more information on how to use the package, refer to the [samples](https://github.com/microsoftgraph/msgraph-sdk-python-core/tree/dev/samples)
61+
62+
## Issues
63+
64+
View or log issues on the [Issues](https://github.com/microsoftgraph/msgraph-sdk-python-core/issues) tab in the repo.
65+
66+
## Contributing
67+
68+
Please see the [contributing guidelines](CONTRIBUTING.rst)
69+
70+
## Copyright and license
71+
72+
Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT [license](LICENSE).
73+
74+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments.
75+
4776

0 commit comments

Comments
 (0)