Skip to content

Commit f038047

Browse files
committed
Some minor fixes to README and methods
1 parent e82a60c commit f038047

File tree

4 files changed

+27
-6
lines changed

4 files changed

+27
-6
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ See [Get access on behalf of a user](https://docs.microsoft.com/en-us/graph/auth
2020
- You can access to [Requests library's Response Object](https://docs.python-requests.org/en/latest/user/advanced/#request-and-response-objects) for e.g. `r = client.users.get_me()` then `r.original` or the response handled by the library `r.data`.
2121
- New Response properties `r.status_code` and `r.throttling`.
2222
- You can pass [Requests library's Event Hooks](https://docs.python-requests.org/en/latest/user/advanced/#event-hooks) with the parameter `requests_hooks` in the client instantiation. If you are using Django and want to log in database every request made through this library, see [django-requests-logger](https://github.com/GearPlug/django-requests-logger).
23+
- Library can auto paginate responses. Set `paginate` parameter in client initialization. Defaults to `True`.
2324
- Better method docstrings and type hinting.
2425
- Better library structure.
2526
## Installing
@@ -61,6 +62,11 @@ response = client.users.get_me()
6162
```
6263

6364
### Mail
65+
66+
#### List messages
67+
```
68+
response = client.mail.list_messages()
69+
```
6470
#### Get message
6571
```
6672
response = client.mail.get_message(message_id)
@@ -79,6 +85,16 @@ data = {
7985
response = client.mail.send_mail(**data)
8086
```
8187

88+
#### List mail folders
89+
```
90+
response = client.mail.list_mail_folders()
91+
```
92+
93+
#### Create mail folder
94+
```
95+
response = client.mail.create_mail_folder(display_name)
96+
```
97+
8298
### Notes
8399
#### List notebooks
84100
```

microsoftgraph/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from urllib.parse import urlencode
22

33
import requests
4-
import copy
4+
55
from microsoftgraph import exceptions
66
from microsoftgraph.calendar import Calendar
77
from microsoftgraph.contacts import Contacts

microsoftgraph/contacts.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,18 @@ def list_contact_folders(self, params: dict = None) -> Response:
9999
return self._client._get(self._client.base_url + "me/contactFolders", params=params)
100100

101101
@token_required
102-
def create_contact_folder(self, **kwargs) -> Response:
102+
def create_contact_folder(self, display_name: str, parent_folder_id: str, **kwargs) -> Response:
103103
"""Create a new contactFolder under the user's default contacts folder.
104104
105105
https://docs.microsoft.com/en-us/graph/api/user-post-contactfolders?view=graph-rest-1.0&tabs=http
106106
107+
Args:
108+
display_name (str): The folder's display name.
109+
parent_folder_id (str): The ID of the folder's parent folder.
110+
107111
Returns:
108112
Response: Microsoft Graph Response.
109113
"""
110-
return self._client._post(self._client.base_url + "me/contactFolders", **kwargs)
114+
data = {"displayName": display_name, "parentFolderId": parent_folder_id}
115+
data.update(kwargs)
116+
return self._client._post(self._client.base_url + "me/contactFolders", json=data)

microsoftgraph/notes.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,5 @@ def create_page(self, section_id: str, files: list) -> Response:
8383
Returns:
8484
Response: Microsoft Graph Response.
8585
"""
86-
return self._client._post(
87-
self._client.base_url + "me/onenote/sections/{}/pages".format(section_id), files=files
88-
)
86+
url = "me/onenote/sections/{}/pages".format(section_id)
87+
return self._client._post(self._client.base_url + url, files=files)

0 commit comments

Comments
 (0)