Skip to content

Commit 7189e3d

Browse files
committed
moved subscriptions to Account method
1 parent 3d0f503 commit 7189e3d

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

O365/account.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,16 @@
22
from typing import Callable, List, Optional, Tuple, Type
33

44
from .connection import Connection, MSGraphProtocol, Protocol
5-
from .subscriptions import Subscriptions
65
from .utils import ME_RESOURCE, consent_input_token
76

87

9-
class Account:
10-
connection_constructor: Type = Connection #: :meta private:
11-
subscriptions_constructor: Type = Subscriptions
12-
13-
def __init__(self, credentials: Tuple[str, str], *,
14-
username: Optional[str] = None,
15-
protocol: Optional[Protocol] = None,
16-
main_resource: Optional[str] = None, **kwargs):
8+
class Account:
9+
connection_constructor: Type = Connection #: :meta private:
10+
11+
def __init__(self, credentials: Tuple[str, str], *,
12+
username: Optional[str] = None,
13+
protocol: Optional[Protocol] = None,
14+
main_resource: Optional[str] = None, **kwargs):
1715
""" Creates an object which is used to access resources related to the specified credentials.
1816
1917
:param credentials: a tuple containing the client_id and client_secret
@@ -62,7 +60,6 @@ def __init__(self, credentials: Tuple[str, str], *,
6260
self.con = self.connection_constructor(credentials, **kwargs)
6361
#: The resource in use for the account. |br| **Type:** str
6462
self.main_resource: str = main_resource or self.protocol.default_resource
65-
self.subscriptions = self.subscriptions_constructor(parent=self)
6663

6764
def __repr__(self):
6865
if self.con.auth:
@@ -369,3 +366,9 @@ def groups(self, *, resource: str = ''):
369366

370367
from .groups import Groups
371368
return Groups(parent=self, main_resource=resource)
369+
370+
def subscriptions(self, *, resource: str = ''):
371+
""" Get an instance to manage MS Graph subscriptions """
372+
373+
from .subscriptions import Subscriptions
374+
return Subscriptions(parent=self, main_resource=resource)

O365/mailbox.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1069,4 +1069,4 @@ def get_settings(self):
10691069

10701070
return self.mailbox_settings_constructor(
10711071
parent=self, **{self._cloud_data_key: data}
1072-
)
1072+
)

0 commit comments

Comments
 (0)