Skip to content

Commit ee25b05

Browse files
committed
Change scopes to requested_scopes
1 parent 2ac7c7e commit ee25b05

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

docs/source/getting_started.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ A common pattern to check for authentication and use the library is this one:
5959

6060
.. code-block:: python
6161
62-
scopes = ['my_required_scopes'] # you can use scope helpers here (see Permissions and Scopes section)
62+
requested_scopes = ['my_required_scopes'] # you can use scope helpers here (see Permissions and Scopes section)
6363
6464
account = Account(credentials)
6565
6666
if not account.is_authenticated: # will check if there is a token and has not expired
6767
# ask for a login using console based authentication. See Authentication for other flows
68-
if account.authenticate(scopes=scopes) is False:
68+
if account.authenticate(requested_scopes=requeated_scopes) is False:
6969
raise RuntimeError('Authentication Failed')
7070
7171
# now we are authenticated
@@ -228,7 +228,7 @@ To authenticate (login) you can use :ref:`different_interfaces`. On the followin
228228
# the default authentication method will be "on behalf of a user"
229229
230230
account = Account(credentials)
231-
if account.authenticate(scopes=['basic', 'message_all']):
231+
if account.authenticate(requested_scopes=['basic', 'message_all']):
232232
print('Authenticated!')
233233
234234
# 'basic' adds: 'https://graph.microsoft.com/User.Read'
@@ -281,7 +281,7 @@ To accomplish the authentication you can basically use different approaches. The
281281
You can authenticate using a console. The best way to achieve this is by using the authenticate method of the Account class.
282282

283283
account = Account(credentials)
284-
account.authenticate(scopes=['basic', 'message_all'])
284+
account.authenticate(requested_scopes=['basic', 'message_all'])
285285
The authenticate method will print into the console an url that you will have to visit to achieve authentication. Then after visiting the link and authenticate you will have to paste back the resulting url into the console. The method will return True and print a message if it was succesful.
286286

287287
**Tip:** When using macOS the console is limited to 1024 characters. If your url has multiple scopes it can exceed this limit. To solve this. Just import readline at the top of your script.
@@ -370,14 +370,14 @@ For example your application can have Calendar.Read, Mail.ReadWrite and Mail.Sen
370370
371371
credentials = ('client_id', 'client_secret')
372372
373-
scopes = ['Mail.ReadWrite', 'Mail.Send']
373+
requested_scopes = ['Mail.ReadWrite', 'Mail.Send']
374374
375-
account = Account(credentials, scopes=scopes)
375+
account = Account(credentials, requested_scopes=requested_scopes)
376376
account.authenticate()
377377
378378
# The latter is exactly the same as passing scopes to the authenticate method like so:
379379
# account = Account(credentials)
380-
# account.authenticate(scopes=scopes)
380+
# account.authenticate(requested_scopes=requested_scopes)
381381
382382
Scope implementation depends on the protocol used. So by using protocol data you can automatically set the scopes needed. This is implemented by using 'scope helpers'. Those are little helpers that group scope functionality and abstract the protocol used.
383383

@@ -419,7 +419,7 @@ You can get the same scopes as before using protocols and scope helpers like thi
419419
scopes_graph = protocol.get_scopes_for('message_all')
420420
# scopes here are: ['https://graph.microsoft.com/Mail.ReadWrite', 'https://graph.microsoft.com/Mail.Send']
421421
422-
account = Account(credentials, scopes=scopes_graph)
422+
account = Account(credentials, requested_scopes=scopes_graph)
423423
424424
.. note::
425425

docs/source/usage/account.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@ Setting Scopes
8888
8989
# Full permission to your mail
9090
account = Account(credentials=('my_client_id', 'my_client_secret'),
91-
scopes=['message_all'])
91+
requested_scopes=['message_all'])
9292
9393
# Why change every time, add all at a time :)
9494
account = Account(credentials=('my_client_id', 'my_client_secret'),
95-
scopes=['message_all', 'message_all_shared', 'address_book_all',
95+
requested_scopes=['message_all', 'message_all_shared', 'address_book_all',
9696
'address_book_all_shared',
9797
'calendar', 'users', 'onedrive', 'sharepoint_dl'])
9898
@@ -143,8 +143,8 @@ You can work only with the required pieces:
143143
from O365.mailbox import MailBox
144144
145145
protocol = MSGraphProtocol()
146-
scopes = ['...']
147-
con = Connection(('client_id', 'client_secret'), scopes=scopes)
146+
requested_scopes = ['...']
147+
con = Connection(('client_id', 'client_secret'), requested_scopes=requested_scopes)
148148
149149
message = Message(con=con, protocol=protocol)
150150
# ...
@@ -186,7 +186,7 @@ It's also easy to implement a custom Class. Just Inherit from ApiComponent, defi
186186
from O365 import Connection, MSGraphProtocol
187187
188188
protocol = MSGraphProtocol() # or maybe a user defined protocol
189-
con = Connection(('client_id', 'client_secret'), scopes=protocol.get_scopes_for(['...']))
189+
con = Connection(('client_id', 'client_secret'), requested_scopes=protocol.get_scopes_for(['...']))
190190
custom_class = CustomClass(con=con, protocol=protocol)
191191
192192
custom_class.do_some_stuff()

0 commit comments

Comments
 (0)