code stringlengths 66 870k | docstring stringlengths 19 26.7k | func_name stringlengths 1 138 | language stringclasses 1
value | repo stringlengths 7 68 | path stringlengths 5 324 | url stringlengths 46 389 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
def __init__(self, *, parent=None, con=None, **kwargs):
""" A Microsoft Teams chat
:param parent: parent object
:type parent: Teams
:param Connection con: connection to use if no parent specified
:param Protocol protocol: protocol to use if no parent specified (kwargs)
:p... | A Microsoft Teams chat
:param parent: parent object
:type parent: Teams
:param Connection con: connection to use if no parent specified
:param Protocol protocol: protocol to use if no parent specified (kwargs)
:param str main_resource: use this resource instead of parent resourc... | __init__ | python | O365/python-o365 | O365/teams.py | https://github.com/O365/python-o365/blob/master/O365/teams.py | Apache-2.0 |
def get_message(self, message_id):
""" Returns a specified message from the chat
:param message_id: the message_id of the message to receive
:type message_id: str or int
:rtype: ChatMessage
"""
url = self.build_url(
self._endpoints.get('get_message').format(me... | Returns a specified message from the chat
:param message_id: the message_id of the message to receive
:type message_id: str or int
:rtype: ChatMessage
| get_message | python | O365/python-o365 | O365/teams.py | https://github.com/O365/python-o365/blob/master/O365/teams.py | Apache-2.0 |
def send_message(self, content=None, content_type='text'):
""" Sends a message to the chat
:param content: str of text, str of html, or dict representation of json body
:type content: str or dict
:param str content_type: 'text' to render the content as text or 'html' to render the conten... | Sends a message to the chat
:param content: str of text, str of html, or dict representation of json body
:type content: str or dict
:param str content_type: 'text' to render the content as text or 'html' to render the content as html
:rtype: ChatMessage
| send_message | python | O365/python-o365 | O365/teams.py | https://github.com/O365/python-o365/blob/master/O365/teams.py | Apache-2.0 |
def get_members(self):
""" Returns a list of conversation members
:rtype: list[ConversationMember]
"""
url = self.build_url(self._endpoints.get('get_members'))
response = self.con.get(url)
if not response:
return None
data = response.json()
mem... | Returns a list of conversation members
:rtype: list[ConversationMember]
| get_members | python | O365/python-o365 | O365/teams.py | https://github.com/O365/python-o365/blob/master/O365/teams.py | Apache-2.0 |
def get_member(self, membership_id):
"""Returns a specified conversation member
:param str membership_id: membership_id of member to retrieve
:rtype: ConversationMember
"""
url = self.build_url(self._endpoints.get('get_member').format(
membership_id=membership_id))
... | Returns a specified conversation member
:param str membership_id: membership_id of member to retrieve
:rtype: ConversationMember
| get_member | python | O365/python-o365 | O365/teams.py | https://github.com/O365/python-o365/blob/master/O365/teams.py | Apache-2.0 |
def __init__(self, *, parent=None, con=None, **kwargs):
""" Microsoft Teams Presence
:param parent: parent object
:type parent: Teams
:param Connection con: connection to use if no parent specified
:param Protocol protocol: protocol to use if no parent specified
(kwargs... | Microsoft Teams Presence
:param parent: parent object
:type parent: Teams
:param Connection con: connection to use if no parent specified
:param Protocol protocol: protocol to use if no parent specified
(kwargs)
:param str main_resource: use this resource instead of pa... | __init__ | python | O365/python-o365 | O365/teams.py | https://github.com/O365/python-o365/blob/master/O365/teams.py | Apache-2.0 |
def __init__(self, *, parent=None, con=None, **kwargs):
""" A Microsoft Teams channel
:param parent: parent object
:type parent: Teams or Team
:param Connection con: connection to use if no parent specified
:param Protocol protocol: protocol to use if no parent specified
... | A Microsoft Teams channel
:param parent: parent object
:type parent: Teams or Team
:param Connection con: connection to use if no parent specified
:param Protocol protocol: protocol to use if no parent specified
(kwargs)
:param str main_resource: use this resource inst... | __init__ | python | O365/python-o365 | O365/teams.py | https://github.com/O365/python-o365/blob/master/O365/teams.py | Apache-2.0 |
def get_message(self, message_id):
""" Returns a specified channel chat messages
:param message_id: number of messages to retrieve
:type message_id: int or str
:rtype: ChannelMessage
"""
url = self.build_url(
self._endpoints.get('get_message').format(message_i... | Returns a specified channel chat messages
:param message_id: number of messages to retrieve
:type message_id: int or str
:rtype: ChannelMessage
| get_message | python | O365/python-o365 | O365/teams.py | https://github.com/O365/python-o365/blob/master/O365/teams.py | Apache-2.0 |
def send_message(self, content=None, content_type='text'):
""" Sends a message to the channel
:param content: str of text, str of html, or dict representation of json body
:type content: str or dict
:param str content_type: 'text' to render the content as text or 'html' to render the con... | Sends a message to the channel
:param content: str of text, str of html, or dict representation of json body
:type content: str or dict
:param str content_type: 'text' to render the content as text or 'html' to render the content as html
:rtype: ChannelMessage
| send_message | python | O365/python-o365 | O365/teams.py | https://github.com/O365/python-o365/blob/master/O365/teams.py | Apache-2.0 |
def __init__(self, *, parent=None, con=None, **kwargs):
""" A Microsoft Teams team
:param parent: parent object
:type parent: Teams
:param Connection con: connection to use if no parent specified
:param Protocol protocol: protocol to use if no parent specified
(kwargs)
... | A Microsoft Teams team
:param parent: parent object
:type parent: Teams
:param Connection con: connection to use if no parent specified
:param Protocol protocol: protocol to use if no parent specified
(kwargs)
:param str main_resource: use this resource instead of pare... | __init__ | python | O365/python-o365 | O365/teams.py | https://github.com/O365/python-o365/blob/master/O365/teams.py | Apache-2.0 |
def get_channels(self):
""" Returns a list of channels the team
:rtype: list[Channel]
"""
url = self.build_url(self._endpoints.get('get_channels'))
response = self.con.get(url)
if not response:
return []
data = response.json()
return [self.... | Returns a list of channels the team
:rtype: list[Channel]
| get_channels | python | O365/python-o365 | O365/teams.py | https://github.com/O365/python-o365/blob/master/O365/teams.py | Apache-2.0 |
def get_channel(self, channel_id):
""" Returns a channel of the team
:param channel_id: the team_id of the channel to be retrieved.
:rtype: Channel
"""
url = self.build_url(self._endpoints.get('get_channel').format(channel_id=channel_id))
response = self.con.get(url)
... | Returns a channel of the team
:param channel_id: the team_id of the channel to be retrieved.
:rtype: Channel
| get_channel | python | O365/python-o365 | O365/teams.py | https://github.com/O365/python-o365/blob/master/O365/teams.py | Apache-2.0 |
def __init__(self, *, parent=None, con=None, **kwargs):
""" A Microsoft Teams app
:param parent: parent object
:type parent: Teams
:param Connection con: connection to use if no parent specified
:param Protocol protocol: protocol to use if no parent specified
(kwargs)
... | A Microsoft Teams app
:param parent: parent object
:type parent: Teams
:param Connection con: connection to use if no parent specified
:param Protocol protocol: protocol to use if no parent specified
(kwargs)
:param str main_resource: use this resource instead of paren... | __init__ | python | O365/python-o365 | O365/teams.py | https://github.com/O365/python-o365/blob/master/O365/teams.py | Apache-2.0 |
def get_my_presence(self):
""" Returns my availability and activity
:rtype: Presence
"""
url = self.build_url(self._endpoints.get('get_my_presence'))
response = self.con.get(url)
if not response:
return None
data = response.json()
return ... | Returns my availability and activity
:rtype: Presence
| get_my_presence | python | O365/python-o365 | O365/teams.py | https://github.com/O365/python-o365/blob/master/O365/teams.py | Apache-2.0 |
def set_my_presence(
self,
session_id,
availability: Availability,
activity: Activity,
expiration_duration,
):
"""Sets my presence status
:param session_id: the session/capplication id.
:param availability: the availability.
:param activity: t... | Sets my presence status
:param session_id: the session/capplication id.
:param availability: the availability.
:param activity: the activity.
:param activity: the expiration_duration when status will be unset.
:rtype: Presence
| set_my_presence | python | O365/python-o365 | O365/teams.py | https://github.com/O365/python-o365/blob/master/O365/teams.py | Apache-2.0 |
def set_my_user_preferred_presence(
self,
availability: PreferredAvailability,
activity: PreferredActivity,
expiration_duration,
):
"""Sets my user preferred presence status
:param availability: the availability.
:param activity: the activity.
:param ... | Sets my user preferred presence status
:param availability: the availability.
:param activity: the activity.
:param activity: the expiration_duration when status will be unset.
:rtype: Presence
| set_my_user_preferred_presence | python | O365/python-o365 | O365/teams.py | https://github.com/O365/python-o365/blob/master/O365/teams.py | Apache-2.0 |
def get_user_presence(self, user_id=None, email=None):
"""Returns specific user availability and activity
:rtype: Presence
"""
url = self.build_url(
self._endpoints.get("get_user_presence").format(user_id=user_id)
)
response = self.con.get(url)
if ... | Returns specific user availability and activity
:rtype: Presence
| get_user_presence | python | O365/python-o365 | O365/teams.py | https://github.com/O365/python-o365/blob/master/O365/teams.py | Apache-2.0 |
def get_my_teams(self):
""" Returns a list of teams that I am in
:rtype: list[Team]
"""
url = self.build_url(self._endpoints.get('get_my_teams'))
response = self.con.get(url)
if not response:
return []
data = response.json()
return [
... | Returns a list of teams that I am in
:rtype: list[Team]
| get_my_teams | python | O365/python-o365 | O365/teams.py | https://github.com/O365/python-o365/blob/master/O365/teams.py | Apache-2.0 |
def get_channels(self, team_id):
""" Returns a list of channels of a specified team
:param team_id: the team_id of the channel to be retrieved.
:rtype: list[Channel]
"""
url = self.build_url(
self._endpoints.get('get_channels').format(team_id=team_id))
res... | Returns a list of channels of a specified team
:param team_id: the team_id of the channel to be retrieved.
:rtype: list[Channel]
| get_channels | python | O365/python-o365 | O365/teams.py | https://github.com/O365/python-o365/blob/master/O365/teams.py | Apache-2.0 |
def create_channel(self, team_id, display_name, description=None):
""" Creates a channel within a specified team
:param team_id: the team_id where the channel is created.
:param display_name: the channel display name.
:param description: the channel description.
:rtype: Channel
... | Creates a channel within a specified team
:param team_id: the team_id where the channel is created.
:param display_name: the channel display name.
:param description: the channel description.
:rtype: Channel
| create_channel | python | O365/python-o365 | O365/teams.py | https://github.com/O365/python-o365/blob/master/O365/teams.py | Apache-2.0 |
def get_channel(self, team_id, channel_id):
""" Returns the channel info for a given channel
:param team_id: the team_id of the channel.
:param channel_id: the channel_id of the channel.
:rtype: list[Channel]
"""
url = self.build_url(
self._endpoints.get('g... | Returns the channel info for a given channel
:param team_id: the team_id of the channel.
:param channel_id: the channel_id of the channel.
:rtype: list[Channel]
| get_channel | python | O365/python-o365 | O365/teams.py | https://github.com/O365/python-o365/blob/master/O365/teams.py | Apache-2.0 |
def get_apps_in_team(self, team_id):
""" Returns a list of apps of a specified team
:param team_id: the team_id of the team to get the apps of.
:rtype: list[App]
"""
url = self.build_url(
self._endpoints.get('get_apps_in_team').format(team_id=team_id))
resp... | Returns a list of apps of a specified team
:param team_id: the team_id of the team to get the apps of.
:rtype: list[App]
| get_apps_in_team | python | O365/python-o365 | O365/teams.py | https://github.com/O365/python-o365/blob/master/O365/teams.py | Apache-2.0 |
def __init__(self, attachment_name_property=None, attachment_type=None):
""" Defines the functionality for an object to be attachable.
Any object that inherits from this class will be attachable
(if the underlying api allows that)
"""
self.__attachment_name = None
self._... | Defines the functionality for an object to be attachable.
Any object that inherits from this class will be attachable
(if the underlying api allows that)
| __init__ | python | O365/python-o365 | O365/utils/attachment.py | https://github.com/O365/python-o365/blob/master/O365/utils/attachment.py | Apache-2.0 |
def attachment_name(self):
""" Name of the attachment
:getter: get attachment name
:setter: set new name for the attachment
:type: str
"""
if self.__attachment_name is not None:
return self.__attachment_name
if self.__attachment_name_property:
... | Name of the attachment
:getter: get attachment name
:setter: set new name for the attachment
:type: str
| attachment_name | python | O365/python-o365 | O365/utils/attachment.py | https://github.com/O365/python-o365/blob/master/O365/utils/attachment.py | Apache-2.0 |
def __init__(self, attachment=None, *, parent=None, **kwargs):
""" Creates a new attachment, optionally from existing cloud data
:param attachment: attachment data (dict = cloud data,
other = user data)
:type attachment: dict or str or Path or list[str] or AttachableMixin
:para... | Creates a new attachment, optionally from existing cloud data
:param attachment: attachment data (dict = cloud data,
other = user data)
:type attachment: dict or str or Path or list[str] or AttachableMixin
:param BaseAttachments parent: the parent Attachments
:param Protocol p... | __init__ | python | O365/python-o365 | O365/utils/attachment.py | https://github.com/O365/python-o365/blob/master/O365/utils/attachment.py | Apache-2.0 |
def save(self, location=None, custom_name=None):
""" Save the attachment locally to disk
:param str location: path string to where the file is to be saved.
:param str custom_name: a custom name to be saved as
:return: Success / Failure
:rtype: bool
"""
if not se... | Save the attachment locally to disk
:param str location: path string to where the file is to be saved.
:param str custom_name: a custom name to be saved as
:return: Success / Failure
:rtype: bool
| save | python | O365/python-o365 | O365/utils/attachment.py | https://github.com/O365/python-o365/blob/master/O365/utils/attachment.py | Apache-2.0 |
def attach(self, api_object, on_cloud=False):
""" Attach this attachment to an existing api_object. This
BaseAttachment object must be an orphan BaseAttachment created for the
sole purpose of attach it to something and therefore run this method.
:param api_object: object to attach to
... | Attach this attachment to an existing api_object. This
BaseAttachment object must be an orphan BaseAttachment created for the
sole purpose of attach it to something and therefore run this method.
:param api_object: object to attach to
:param on_cloud: if the attachment is on cloud or n... | attach | python | O365/python-o365 | O365/utils/attachment.py | https://github.com/O365/python-o365/blob/master/O365/utils/attachment.py | Apache-2.0 |
def __init__(self, parent, attachments=None):
""" Attachments must be a list of path strings or dictionary elements
:param Account parent: parent object
:param attachments: list of attachments
:type attachments: list[str] or list[Path] or str or Path or dict
"""
super().... | Attachments must be a list of path strings or dictionary elements
:param Account parent: parent object
:param attachments: list of attachments
:type attachments: list[str] or list[Path] or str or Path or dict
| __init__ | python | O365/python-o365 | O365/utils/attachment.py | https://github.com/O365/python-o365/blob/master/O365/utils/attachment.py | Apache-2.0 |
def _track_changes(self):
""" Update the track_changes on the parent to reflect
a needed update on this field """
if getattr(self._parent, '_track_changes',
None) is not None and self.untrack is False:
# noinspection PyProtectedMember
self._parent._trac... | Update the track_changes on the parent to reflect
a needed update on this field | _track_changes | python | O365/python-o365 | O365/utils/attachment.py | https://github.com/O365/python-o365/blob/master/O365/utils/attachment.py | Apache-2.0 |
def _update_parent_attachments(self):
""" Tries to update the parent property 'has_attachments' """
try:
self._parent.has_attachments = bool(len(self.__attachments))
except AttributeError:
pass | Tries to update the parent property 'has_attachments' | _update_parent_attachments | python | O365/python-o365 | O365/utils/attachment.py | https://github.com/O365/python-o365/blob/master/O365/utils/attachment.py | Apache-2.0 |
def add(self, attachments):
""" Add more attachments
:param attachments: list of attachments
:type attachments: list[str] or list[Path] or str or Path or dict
"""
if attachments:
if isinstance(attachments, (str, Path)):
attachments = [attachments]
... | Add more attachments
:param attachments: list of attachments
:type attachments: list[str] or list[Path] or str or Path or dict
| add | python | O365/python-o365 | O365/utils/attachment.py | https://github.com/O365/python-o365/blob/master/O365/utils/attachment.py | Apache-2.0 |
def remove(self, attachments):
""" Remove the specified attachments
:param attachments: list of attachments
:type attachments: list[str] or list[Path] or str or Path or dict
"""
if isinstance(attachments, (list, tuple)):
attachments = ({attachment.name
... | Remove the specified attachments
:param attachments: list of attachments
:type attachments: list[str] or list[Path] or str or Path or dict
| remove | python | O365/python-o365 | O365/utils/attachment.py | https://github.com/O365/python-o365/blob/master/O365/utils/attachment.py | Apache-2.0 |
def download_attachments(self):
""" Downloads this message attachments into memory.
Need a call to 'attachment.save' to save them on disk.
:return: Success / Failure
:rtype: bool
"""
if not self._parent.has_attachments:
log.debug(
'Parent {} h... | Downloads this message attachments into memory.
Need a call to 'attachment.save' to save them on disk.
:return: Success / Failure
:rtype: bool
| download_attachments | python | O365/python-o365 | O365/utils/attachment.py | https://github.com/O365/python-o365/blob/master/O365/utils/attachment.py | Apache-2.0 |
def _update_attachments_to_cloud(self, chunk_size=None):
""" Push new, unsaved attachments to the cloud and remove removed
attachments. This method should not be called for non draft messages.
"""
# ! potentially several api requests can be made by this method.
chunk_size = chunk... | Push new, unsaved attachments to the cloud and remove removed
attachments. This method should not be called for non draft messages.
| _update_attachments_to_cloud | python | O365/python-o365 | O365/utils/attachment.py | https://github.com/O365/python-o365/blob/master/O365/utils/attachment.py | Apache-2.0 |
def to_upper_lower_case(value: str, upper: bool = True) -> str:
"""Convert string into upper or lower case"""
value = re.sub(r"\w[\s\W]+\w", '', str(value))
if not value:
return value
first_letter = str(value[0])
if upper:
first_letter = first_letter.upper()
else:
first... | Convert string into upper or lower case | to_upper_lower_case | python | O365/python-o365 | O365/utils/casing.py | https://github.com/O365/python-o365/blob/master/O365/utils/casing.py | Apache-2.0 |
def deprecated(version, *replacement):
""" Decorator to mark a specified function as deprecated
:param version: version in which it is deprecated
:param replacement: replacement functions to use
"""
def deprecated_wrapper(func):
replacement_message = 'Use {} instead'.format(', '.join(
... | Decorator to mark a specified function as deprecated
:param version: version in which it is deprecated
:param replacement: replacement functions to use
| deprecated | python | O365/python-o365 | O365/utils/decorators.py | https://github.com/O365/python-o365/blob/master/O365/utils/decorators.py | Apache-2.0 |
def get_filter_by_attribute(self, attribute: str) -> Optional[str]:
"""
Returns a filter value by attribute name. It will match the attribute to the start of each filter attribute
and return the first found.
:param attribute: the attribute you want to search
:return: The... |
Returns a filter value by attribute name. It will match the attribute to the start of each filter attribute
and return the first found.
:param attribute: the attribute you want to search
:return: The value applied to that attribute or None
| get_filter_by_attribute | python | O365/python-o365 | O365/utils/query.py | https://github.com/O365/python-o365/blob/master/O365/utils/query.py | Apache-2.0 |
def has_only_filters(self) -> bool:
""" Returns true if it only has filters"""
return (self.filters is not None and self.search is None and
self.order_by is None and self.select is None and self.expand is None) | Returns true if it only has filters | has_only_filters | python | O365/python-o365 | O365/utils/query.py | https://github.com/O365/python-o365/blob/master/O365/utils/query.py | Apache-2.0 |
def __and__(self, other: Optional[QueryBase]) -> CompositeFilter:
""" Combine this CompositeFilter with another QueryBase object """
if other is None:
return self
nc = CompositeFilter(filters=self.filters, search=self.search, order_by=self.order_by,
selec... | Combine this CompositeFilter with another QueryBase object | __and__ | python | O365/python-o365 | O365/utils/query.py | https://github.com/O365/python-o365/blob/master/O365/utils/query.py | Apache-2.0 |
def _parse_filter_word(self, word: FilterWord) -> str:
""" Converts the word parameter into a string """
if isinstance(word, str):
# string must be enclosed in quotes
parsed_word = f"'{word}'"
elif isinstance(word, bool):
# bools are treated as lower case bool... | Converts the word parameter into a string | _parse_filter_word | python | O365/python-o365 | O365/utils/query.py | https://github.com/O365/python-o365/blob/master/O365/utils/query.py | Apache-2.0 |
def _get_attribute_from_mapping(self, attribute: str) -> str:
"""
Look up the provided attribute into the query builder mapping
Applies a conversion to the appropriate casing defined by the protocol.
:param attribute: attribute to look up
:return: the attribute itself of if foun... |
Look up the provided attribute into the query builder mapping
Applies a conversion to the appropriate casing defined by the protocol.
:param attribute: attribute to look up
:return: the attribute itself of if found the corresponding complete attribute in the mapping
| _get_attribute_from_mapping | python | O365/python-o365 | O365/utils/query.py | https://github.com/O365/python-o365/blob/master/O365/utils/query.py | Apache-2.0 |
def logical_operation(self, operation: str, attribute: str, word: FilterWord) -> CompositeFilter:
""" Apply a logical operation like equals, less than, etc.
:param operation: how to combine with a new one
:param attribute: attribute to compare word with
:param word: value to compare the... | Apply a logical operation like equals, less than, etc.
:param operation: how to combine with a new one
:param attribute: attribute to compare word with
:param word: value to compare the attribute with
:return: a CompositeFilter instance that can render the OData logical operation
... | logical_operation | python | O365/python-o365 | O365/utils/query.py | https://github.com/O365/python-o365/blob/master/O365/utils/query.py | Apache-2.0 |
def function_operation(self, operation: str, attribute: str, word: FilterWord) -> CompositeFilter:
""" Apply a function operation
:param operation: function name to operate on attribute
:param attribute: the name of the attribute on which to apply the function
:param word: value to feed... | Apply a function operation
:param operation: function name to operate on attribute
:param attribute: the name of the attribute on which to apply the function
:param word: value to feed the function
:return: a CompositeFilter instance that can render the OData function operation
... | function_operation | python | O365/python-o365 | O365/utils/query.py | https://github.com/O365/python-o365/blob/master/O365/utils/query.py | Apache-2.0 |
def iterable_operation(self, operation: str, collection: str, filter_instance: CompositeFilter,
*, item_name: str = "a") -> CompositeFilter:
""" Performs the provided filter operation on a collection by iterating over it.
For example:
.. code-block:: python
... | Performs the provided filter operation on a collection by iterating over it.
For example:
.. code-block:: python
q.iterable(
operation='any',
collection='email_addresses',
filter_instance=q.equals('address', 'george@best.com')
)... | iterable_operation | python | O365/python-o365 | O365/utils/query.py | https://github.com/O365/python-o365/blob/master/O365/utils/query.py | Apache-2.0 |
def search(self, word: Union[str, int, bool], attribute: Optional[str] = None) -> CompositeFilter:
"""
Perform a search.
Note from graph docs:
You can currently search only message and person collections.
A $search request returns up to 250 results.
You cannot use $fi... |
Perform a search.
Note from graph docs:
You can currently search only message and person collections.
A $search request returns up to 250 results.
You cannot use $filter or $orderby in a search request.
:param word: the text to search
:param attribute: the a... | search | python | O365/python-o365 | O365/utils/query.py | https://github.com/O365/python-o365/blob/master/O365/utils/query.py | Apache-2.0 |
def orderby(*attributes: tuple[Union[str, tuple[str, bool]]]) -> CompositeFilter:
"""
Returns an 'order by' query param
This is useful to order the result set of query from a resource.
Note that not all attributes can be sorted and that all resources have different sort capabilities
... |
Returns an 'order by' query param
This is useful to order the result set of query from a resource.
Note that not all attributes can be sorted and that all resources have different sort capabilities
:param attributes: the attributes to orderby
:return: a CompositeFilter instance... | orderby | python | O365/python-o365 | O365/utils/query.py | https://github.com/O365/python-o365/blob/master/O365/utils/query.py | Apache-2.0 |
def expand(self, relationship: str, select: Optional[CompositeFilter] = None) -> CompositeFilter:
"""
Returns an 'expand' query param
Important: If the 'expand' is a relationship (e.g. "event" or "attachments"), then the ApiComponent using
this query should know how to handle the relatio... |
Returns an 'expand' query param
Important: If the 'expand' is a relationship (e.g. "event" or "attachments"), then the ApiComponent using
this query should know how to handle the relationship (e.g. Message knows how to handle attachments,
and event (if it's an EventMessage).
Imp... | expand | python | O365/python-o365 | O365/utils/query.py | https://github.com/O365/python-o365/blob/master/O365/utils/query.py | Apache-2.0 |
def token_expiration_datetime(
self, *, username: Optional[str] = None
) -> Optional[dt.datetime]:
"""
Returns the current access token expiration datetime
If the refresh token is present, then the expiration datetime is extended by 3 months
:param str username: The username ... |
Returns the current access token expiration datetime
If the refresh token is present, then the expiration datetime is extended by 3 months
:param str username: The username from which check the tokens
:return dt.datetime or None: The expiration datetime
| token_expiration_datetime | python | O365/python-o365 | O365/utils/token.py | https://github.com/O365/python-o365/blob/master/O365/utils/token.py | Apache-2.0 |
def token_is_expired(self, *, username: Optional[str] = None) -> bool:
"""
Checks whether the current access token is expired
:param str username: The username from which check the tokens
:return bool: True if the token is expired, False otherwise
"""
token_expiration_dat... |
Checks whether the current access token is expired
:param str username: The username from which check the tokens
:return bool: True if the token is expired, False otherwise
| token_is_expired | python | O365/python-o365 | O365/utils/token.py | https://github.com/O365/python-o365/blob/master/O365/utils/token.py | Apache-2.0 |
def _get_home_account_id(self, username: str) -> Optional[str]:
"""Gets the home_account_id string from the ACCOUNT cache for the specified username"""
result = list(
self.search(TokenCache.CredentialType.ACCOUNT, query={"username": username})
)
if result:
return... | Gets the home_account_id string from the ACCOUNT cache for the specified username | _get_home_account_id | python | O365/python-o365 | O365/utils/token.py | https://github.com/O365/python-o365/blob/master/O365/utils/token.py | Apache-2.0 |
def get_account(
self, *, username: Optional[str] = None, home_account_id: Optional[str] = None
) -> Optional[dict]:
"""Gets the account object for the specified username or home_account_id"""
if username and home_account_id:
raise ValueError(
'Provide nothing or ... | Gets the account object for the specified username or home_account_id | get_account | python | O365/python-o365 | O365/utils/token.py | https://github.com/O365/python-o365/blob/master/O365/utils/token.py | Apache-2.0 |
def get_access_token(self, *, username: Optional[str] = None) -> Optional[dict]:
"""
Retrieve the stored access token
If username is None, then the first access token will be retrieved
:param str username: The username from which retrieve the access token
"""
query = None... |
Retrieve the stored access token
If username is None, then the first access token will be retrieved
:param str username: The username from which retrieve the access token
| get_access_token | python | O365/python-o365 | O365/utils/token.py | https://github.com/O365/python-o365/blob/master/O365/utils/token.py | Apache-2.0 |
def get_refresh_token(self, *, username: Optional[str] = None) -> Optional[dict]:
"""Retrieve the stored refresh token
If username is None, then the first access token will be retrieved
:param str username: The username from which retrieve the refresh token
"""
query = None
... | Retrieve the stored refresh token
If username is None, then the first access token will be retrieved
:param str username: The username from which retrieve the refresh token
| get_refresh_token | python | O365/python-o365 | O365/utils/token.py | https://github.com/O365/python-o365/blob/master/O365/utils/token.py | Apache-2.0 |
def get_id_token(self, *, username: Optional[str] = None) -> Optional[dict]:
"""Retrieve the stored id token
If username is None, then the first id token will be retrieved
:param str username: The username from which retrieve the id token
"""
query = None
if username is n... | Retrieve the stored id token
If username is None, then the first id token will be retrieved
:param str username: The username from which retrieve the id token
| get_id_token | python | O365/python-o365 | O365/utils/token.py | https://github.com/O365/python-o365/blob/master/O365/utils/token.py | Apache-2.0 |
def get_token_scopes(
self, *, username: Optional[str] = None, remove_reserved: bool = False
) -> Optional[list]:
"""
Retrieve the scopes the token (refresh first then access) has permissions on
:param str username: The username from which retrieve the refresh token
:param bo... |
Retrieve the scopes the token (refresh first then access) has permissions on
:param str username: The username from which retrieve the refresh token
:param bool remove_reserved: if True RESERVED_SCOPES will be removed from the list
| get_token_scopes | python | O365/python-o365 | O365/utils/token.py | https://github.com/O365/python-o365/blob/master/O365/utils/token.py | Apache-2.0 |
def remove_data(self, *, username: str) -> bool:
"""
Removes all tokens and all related data from the token cache for the specified username.
Returns success or failure.
:param str username: The username from which remove the tokens and related data
"""
home_account_id = ... |
Removes all tokens and all related data from the token cache for the specified username.
Returns success or failure.
:param str username: The username from which remove the tokens and related data
| remove_data | python | O365/python-o365 | O365/utils/token.py | https://github.com/O365/python-o365/blob/master/O365/utils/token.py | Apache-2.0 |
def serialize(self) -> Union[bytes, str]:
"""Serialize the current cache state into a string."""
with self._lock:
self._has_state_changed = False
token_str = self.serializer.dumps(self._cache, indent=4)
if self.cryptography_manager is not None:
token_s... | Serialize the current cache state into a string. | serialize | python | O365/python-o365 | O365/utils/token.py | https://github.com/O365/python-o365/blob/master/O365/utils/token.py | Apache-2.0 |
def deserialize(self, token_cache_state: Union[bytes, str]) -> dict:
"""Deserialize the cache from a state previously obtained by serialize()"""
with self._lock:
self._has_state_changed = False
if self.cryptography_manager is not None:
token_cache_state = self.cry... | Deserialize the cache from a state previously obtained by serialize() | deserialize | python | O365/python-o365 | O365/utils/token.py | https://github.com/O365/python-o365/blob/master/O365/utils/token.py | Apache-2.0 |
def should_refresh_token(self, con: Optional[Connection] = None, *,
username: Optional[str] = None) -> Optional[bool]:
"""
This method is intended to be implemented for environments
where multiple Connection instances are running on parallel.
This method sho... |
This method is intended to be implemented for environments
where multiple Connection instances are running on parallel.
This method should check if it's time to refresh the token or not.
The chosen backend can store a flag somewhere to answer this question.
This can avoid race ... | should_refresh_token | python | O365/python-o365 | O365/utils/token.py | https://github.com/O365/python-o365/blob/master/O365/utils/token.py | Apache-2.0 |
def __init__(self, token_path=None, token_filename=None):
"""
Init Backend
:param str or Path token_path: the path where to store the token
:param str token_filename: the name of the token file
"""
super().__init__()
if not isinstance(token_path, Path):
... |
Init Backend
:param str or Path token_path: the path where to store the token
:param str token_filename: the name of the token file
| __init__ | python | O365/python-o365 | O365/utils/token.py | https://github.com/O365/python-o365/blob/master/O365/utils/token.py | Apache-2.0 |
def load_token(self) -> bool:
"""
Retrieves the token from the File System and stores it in the cache
:return bool: Success / Failure
"""
if self.token_path.exists():
with self.token_path.open("r") as token_file:
token_dict = self.deserialize(token_fil... |
Retrieves the token from the File System and stores it in the cache
:return bool: Success / Failure
| load_token | python | O365/python-o365 | O365/utils/token.py | https://github.com/O365/python-o365/blob/master/O365/utils/token.py | Apache-2.0 |
def save_token(self, force=False) -> bool:
"""
Saves the token cache dict in the specified file
Will create the folder if it doesn't exist
:param bool force: Force save even when state has not changed
:return bool: Success / Failure
"""
if not self._cache:
... |
Saves the token cache dict in the specified file
Will create the folder if it doesn't exist
:param bool force: Force save even when state has not changed
:return bool: Success / Failure
| save_token | python | O365/python-o365 | O365/utils/token.py | https://github.com/O365/python-o365/blob/master/O365/utils/token.py | Apache-2.0 |
def delete_token(self) -> bool:
"""
Deletes the token file
:return bool: Success / Failure
"""
if self.token_path.exists():
self.token_path.unlink()
return True
return False |
Deletes the token file
:return bool: Success / Failure
| delete_token | python | O365/python-o365 | O365/utils/token.py | https://github.com/O365/python-o365/blob/master/O365/utils/token.py | Apache-2.0 |
def __init__(self, token_env_name=None):
"""
Init Backend
:param str token_env_name: the name of the environmental variable that will hold the token
"""
super().__init__()
#: Name of the environment token (Default - `O365TOKEN`). |br| **Type:** str
self.token_en... |
Init Backend
:param str token_env_name: the name of the environmental variable that will hold the token
| __init__ | python | O365/python-o365 | O365/utils/token.py | https://github.com/O365/python-o365/blob/master/O365/utils/token.py | Apache-2.0 |
def load_token(self) -> bool:
"""
Retrieves the token from the environmental variable
:return bool: Success / Failure
"""
if self.token_env_name in os.environ:
self._cache = self.deserialize(os.environ.get(self.token_env_name))
return True
return F... |
Retrieves the token from the environmental variable
:return bool: Success / Failure
| load_token | python | O365/python-o365 | O365/utils/token.py | https://github.com/O365/python-o365/blob/master/O365/utils/token.py | Apache-2.0 |
def save_token(self, force=False) -> bool:
"""
Saves the token dict in the specified environmental variable
:param bool force: Force save even when state has not changed
:return bool: Success / Failure
"""
if not self._cache:
return False
if force is ... |
Saves the token dict in the specified environmental variable
:param bool force: Force save even when state has not changed
:return bool: Success / Failure
| save_token | python | O365/python-o365 | O365/utils/token.py | https://github.com/O365/python-o365/blob/master/O365/utils/token.py | Apache-2.0 |
def delete_token(self) -> bool:
"""
Deletes the token environmental variable
:return bool: Success / Failure
"""
if self.token_env_name in os.environ:
del os.environ[self.token_env_name]
return True
return False |
Deletes the token environmental variable
:return bool: Success / Failure
| delete_token | python | O365/python-o365 | O365/utils/token.py | https://github.com/O365/python-o365/blob/master/O365/utils/token.py | Apache-2.0 |
def __init__(self, client, collection, doc_id, field_name="token"):
"""
Init Backend
:param firestore.Client client: the firestore Client instance
:param str collection: the firestore collection where to store tokens (can be a field_path)
:param str doc_id: # the key of the token... |
Init Backend
:param firestore.Client client: the firestore Client instance
:param str collection: the firestore collection where to store tokens (can be a field_path)
:param str doc_id: # the key of the token document. Must be unique per-case.
:param str field_name: the name of ... | __init__ | python | O365/python-o365 | O365/utils/token.py | https://github.com/O365/python-o365/blob/master/O365/utils/token.py | Apache-2.0 |
def load_token(self) -> bool:
"""
Retrieves the token from the store
:return bool: Success / Failure
"""
try:
doc = self.doc_ref.get()
except Exception as e:
log.error(
f"Token (collection: {self.collection}, doc_id: {self.doc_id}) ... |
Retrieves the token from the store
:return bool: Success / Failure
| load_token | python | O365/python-o365 | O365/utils/token.py | https://github.com/O365/python-o365/blob/master/O365/utils/token.py | Apache-2.0 |
def save_token(self, force=False) -> bool:
"""
Saves the token dict in the store
:param bool force: Force save even when state has not changed
:return bool: Success / Failure
"""
if not self._cache:
return False
if force is False and self._has_state_c... |
Saves the token dict in the store
:param bool force: Force save even when state has not changed
:return bool: Success / Failure
| save_token | python | O365/python-o365 | O365/utils/token.py | https://github.com/O365/python-o365/blob/master/O365/utils/token.py | Apache-2.0 |
def delete_token(self) -> bool:
"""
Deletes the token from the store
:return bool: Success / Failure
"""
try:
self.doc_ref.delete()
except Exception as e:
log.error(
f"Could not delete the token (key: {self.doc_id}): {e}"
... |
Deletes the token from the store
:return bool: Success / Failure
| delete_token | python | O365/python-o365 | O365/utils/token.py | https://github.com/O365/python-o365/blob/master/O365/utils/token.py | Apache-2.0 |
def check_token(self) -> bool:
"""
Checks if the token exists
:return bool: True if it exists on the store
"""
try:
doc = self.doc_ref.get()
except Exception as e:
log.error(
f"Token (collection: {self.collection}, doc_id:"
... |
Checks if the token exists
:return bool: True if it exists on the store
| check_token | python | O365/python-o365 | O365/utils/token.py | https://github.com/O365/python-o365/blob/master/O365/utils/token.py | Apache-2.0 |
def __init__(self, bucket_name, filename):
"""
Init Backend
:param str bucket_name: Name of the S3 bucket
:param str filename: Name of the S3 file
"""
try:
import boto3
except ModuleNotFoundError as e:
raise Exception(
"Plea... |
Init Backend
:param str bucket_name: Name of the S3 bucket
:param str filename: Name of the S3 file
| __init__ | python | O365/python-o365 | O365/utils/token.py | https://github.com/O365/python-o365/blob/master/O365/utils/token.py | Apache-2.0 |
def load_token(self) -> bool:
"""
Retrieves the token from the store
:return bool: Success / Failure
"""
try:
token_object = self._client.get_object(
Bucket=self.bucket_name, Key=self.filename
)
self._cache = self.deserialize(t... |
Retrieves the token from the store
:return bool: Success / Failure
| load_token | python | O365/python-o365 | O365/utils/token.py | https://github.com/O365/python-o365/blob/master/O365/utils/token.py | Apache-2.0 |
def __init__(self, secret_name, region_name):
"""
Init Backend
:param str secret_name: Name of the secret stored in Secrets Manager
:param str region_name: AWS region hosting the secret (for example, 'us-east-2')
"""
try:
import boto3
except ModuleNotF... |
Init Backend
:param str secret_name: Name of the secret stored in Secrets Manager
:param str region_name: AWS region hosting the secret (for example, 'us-east-2')
| __init__ | python | O365/python-o365 | O365/utils/token.py | https://github.com/O365/python-o365/blob/master/O365/utils/token.py | Apache-2.0 |
def __init__(self, access_token: str, secret_id: str):
"""
Init Backend
:param str access_token: Access Token used to access the Bitwarden Secrets Manager API
:param str secret_id: ID of Bitwarden Secret used to store the O365 token
"""
try:
from bitwarden_sdk... |
Init Backend
:param str access_token: Access Token used to access the Bitwarden Secrets Manager API
:param str secret_id: ID of Bitwarden Secret used to store the O365 token
| __init__ | python | O365/python-o365 | O365/utils/token.py | https://github.com/O365/python-o365/blob/master/O365/utils/token.py | Apache-2.0 |
def load_token(self) -> bool:
"""
Retrieves the token from Bitwarden Secrets Manager
:return bool: Success / Failure
"""
resp = self.client.secrets().get(self.secret_id)
if not resp.success:
return False
self.secret = resp.data
try:
... |
Retrieves the token from Bitwarden Secrets Manager
:return bool: Success / Failure
| load_token | python | O365/python-o365 | O365/utils/token.py | https://github.com/O365/python-o365/blob/master/O365/utils/token.py | Apache-2.0 |
def save_token(self, force=False) -> bool:
"""
Saves the token dict in Bitwarden Secrets Manager
:param bool force: Force save even when state has not changed
:return bool: Success / Failure
"""
if self.secret is None:
raise ValueError('You have to set "self.s... |
Saves the token dict in Bitwarden Secrets Manager
:param bool force: Force save even when state has not changed
:return bool: Success / Failure
| save_token | python | O365/python-o365 | O365/utils/token.py | https://github.com/O365/python-o365/blob/master/O365/utils/token.py | Apache-2.0 |
def __init__(self, token_model=None):
"""
Initializes the DjangoTokenBackend.
:param token_model: The Django model class to use for storing and retrieving tokens (defaults to TokenModel).
"""
super().__init__()
# Use the provided token_model class
#: Django token... |
Initializes the DjangoTokenBackend.
:param token_model: The Django model class to use for storing and retrieving tokens (defaults to TokenModel).
| __init__ | python | O365/python-o365 | O365/utils/token.py | https://github.com/O365/python-o365/blob/master/O365/utils/token.py | Apache-2.0 |
def load_token(self) -> bool:
"""
Retrieves the latest token from the Django database
:return bool: Success / Failure
"""
try:
# Retrieve the latest token based on the most recently created record
token_record = self.token_model.objects.latest("created_at... |
Retrieves the latest token from the Django database
:return bool: Success / Failure
| load_token | python | O365/python-o365 | O365/utils/token.py | https://github.com/O365/python-o365/blob/master/O365/utils/token.py | Apache-2.0 |
def save_token(self, force=False) -> bool:
"""
Saves the token dict in the Django database
:param bool force: Force save even when state has not changed
:return bool: Success / Failure
"""
if not self._cache:
return False
if force is False and self._h... |
Saves the token dict in the Django database
:param bool force: Force save even when state has not changed
:return bool: Success / Failure
| save_token | python | O365/python-o365 | O365/utils/token.py | https://github.com/O365/python-o365/blob/master/O365/utils/token.py | Apache-2.0 |
def delete_token(self) -> bool:
"""
Deletes the latest token from the Django database
:return bool: Success / Failure
"""
try:
# Delete the latest token
token_record = self.token_model.objects.latest("created_at")
token_record.delete()
... |
Deletes the latest token from the Django database
:return bool: Success / Failure
| delete_token | python | O365/python-o365 | O365/utils/token.py | https://github.com/O365/python-o365/blob/master/O365/utils/token.py | Apache-2.0 |
def from_value(cls, value):
""" Gets a member by a snaked-case provided value"""
try:
return cls(to_snake_case(value))
except ValueError:
return None | Gets a member by a snaked-case provided value | from_value | python | O365/python-o365 | O365/utils/utils.py | https://github.com/O365/python-o365/blob/master/O365/utils/utils.py | Apache-2.0 |
def __init__(self, address=None, name=None, parent=None, field=None):
""" Create a recipient with provided information
:param str address: email address of the recipient
:param str name: name of the recipient
:param HandleRecipientsMixin parent: parent recipients handler
:param ... | Create a recipient with provided information
:param str address: email address of the recipient
:param str name: name of the recipient
:param HandleRecipientsMixin parent: parent recipients handler
:param str field: name of the field to update back
| __init__ | python | O365/python-o365 | O365/utils/utils.py | https://github.com/O365/python-o365/blob/master/O365/utils/utils.py | Apache-2.0 |
def _track_changes(self):
""" Update the track_changes on the parent to reflect a
needed update on this field """
if self._field and getattr(self._parent, '_track_changes',
None) is not None:
self._parent._track_changes.add(self._field) | Update the track_changes on the parent to reflect a
needed update on this field | _track_changes | python | O365/python-o365 | O365/utils/utils.py | https://github.com/O365/python-o365/blob/master/O365/utils/utils.py | Apache-2.0 |
def __init__(self, recipients=None, parent=None, field=None):
""" Recipients must be a list of either address strings or
tuples (name, address) or dictionary elements
:param recipients: list of either address strings or
tuples (name, address) or dictionary elements
:type recipi... | Recipients must be a list of either address strings or
tuples (name, address) or dictionary elements
:param recipients: list of either address strings or
tuples (name, address) or dictionary elements
:type recipients: list[str] or list[tuple] or list[dict]
or list[Recipient]
... | __init__ | python | O365/python-o365 | O365/utils/utils.py | https://github.com/O365/python-o365/blob/master/O365/utils/utils.py | Apache-2.0 |
def add(self, recipients):
""" Add the supplied recipients to the exiting list
:param recipients: list of either address strings or
tuples (name, address) or dictionary elements
:type recipients: list[str] or list[tuple] or list[dict]
"""
if recipients:
if ... | Add the supplied recipients to the exiting list
:param recipients: list of either address strings or
tuples (name, address) or dictionary elements
:type recipients: list[str] or list[tuple] or list[dict]
| add | python | O365/python-o365 | O365/utils/utils.py | https://github.com/O365/python-o365/blob/master/O365/utils/utils.py | Apache-2.0 |
def remove(self, address):
""" Remove an address or multiple addresses
:param address: list of addresses to remove
:type address: str or list[str]
"""
recipients = []
if isinstance(address, str):
address = {address} # set
elif isinstance(address, (li... | Remove an address or multiple addresses
:param address: list of addresses to remove
:type address: str or list[str]
| remove | python | O365/python-o365 | O365/utils/utils.py | https://github.com/O365/python-o365/blob/master/O365/utils/utils.py | Apache-2.0 |
def get_first_recipient_with_address(self):
""" Returns the first recipient found with a non blank address
:return: First Recipient
:rtype: Recipient
"""
recipients_with_address = [recipient for recipient in self._recipients
if recipient.addres... | Returns the first recipient found with a non blank address
:return: First Recipient
:rtype: Recipient
| get_first_recipient_with_address | python | O365/python-o365 | O365/utils/utils.py | https://github.com/O365/python-o365/blob/master/O365/utils/utils.py | Apache-2.0 |
def _recipients_from_cloud(self, recipients, field=None):
""" Transform a recipient from cloud data to object data """
recipients_data = []
for recipient in recipients:
recipients_data.append(
self._recipient_from_cloud(recipient, field=field))
return Recipien... | Transform a recipient from cloud data to object data | _recipients_from_cloud | python | O365/python-o365 | O365/utils/utils.py | https://github.com/O365/python-o365/blob/master/O365/utils/utils.py | Apache-2.0 |
def _recipient_to_cloud(self, recipient):
""" Transforms a Recipient object to a cloud dict """
data = None
if recipient:
data = {self._cc('emailAddress'): {
self._cc('address'): recipient.address}}
if recipient.name:
data[self._cc('emailAd... | Transforms a Recipient object to a cloud dict | _recipient_to_cloud | python | O365/python-o365 | O365/utils/utils.py | https://github.com/O365/python-o365/blob/master/O365/utils/utils.py | Apache-2.0 |
def __init__(self, *, protocol=None, main_resource=None, **kwargs):
""" Object initialization
:param Protocol protocol: A protocol class or instance to be used with
this connection
:param str main_resource: main_resource to be used in these API
communications
"""
... | Object initialization
:param Protocol protocol: A protocol class or instance to be used with
this connection
:param str main_resource: main_resource to be used in these API
communications
| __init__ | python | O365/python-o365 | O365/utils/utils.py | https://github.com/O365/python-o365/blob/master/O365/utils/utils.py | Apache-2.0 |
def build_base_url(self, resource):
"""
Builds the base url of this ApiComponent
:param str resource: the resource to build the base url
"""
main_resource = self._parse_resource(resource if resource is not None else self.protocol.default_resource)
# noinspection PyUnresol... |
Builds the base url of this ApiComponent
:param str resource: the resource to build the base url
| build_base_url | python | O365/python-o365 | O365/utils/utils.py | https://github.com/O365/python-o365/blob/master/O365/utils/utils.py | Apache-2.0 |
def _parse_date_time_time_zone(self,
date_time_time_zone: Union[dict, str],
is_all_day: bool = False) -> Union[dt.datetime, None]:
"""
Parses and convert to protocol timezone a dateTimeTimeZone resource
This resource is a dict... |
Parses and convert to protocol timezone a dateTimeTimeZone resource
This resource is a dict with a date time and a windows timezone
This is a common structure on Microsoft apis so it's included here.
Returns a dt.datetime with the datime converted to protocol timezone
| _parse_date_time_time_zone | python | O365/python-o365 | O365/utils/utils.py | https://github.com/O365/python-o365/blob/master/O365/utils/utils.py | Apache-2.0 |
def _build_date_time_time_zone(self, date_time: dt.datetime) -> Dict[str, str]:
""" Converts a datetime to a dateTimeTimeZone resource Dict[datetime, windows timezone] """
timezone = None
# extract timezone ZoneInfo from provided datetime
if date_time.tzinfo is not None:
if ... | Converts a datetime to a dateTimeTimeZone resource Dict[datetime, windows timezone] | _build_date_time_time_zone | python | O365/python-o365 | O365/utils/utils.py | https://github.com/O365/python-o365/blob/master/O365/utils/utils.py | Apache-2.0 |
def new_query(self, attribute=None):
""" Create a new query to filter results
:param str attribute: attribute to apply the query for
:return: new Query
:rtype: Query
"""
warnings.warn('This method will be deprecated in future releases. A new Query object is finished and ... | Create a new query to filter results
:param str attribute: attribute to apply the query for
:return: new Query
:rtype: Query
| new_query | python | O365/python-o365 | O365/utils/utils.py | https://github.com/O365/python-o365/blob/master/O365/utils/utils.py | Apache-2.0 |
def __init__(self, attribute=None, *, protocol):
""" Build a query to apply OData filters
https://docs.microsoft.com/en-us/graph/query-parameters
:param str attribute: attribute to apply the query for
:param Protocol protocol: protocol to use for connecting
"""
#: Protoc... | Build a query to apply OData filters
https://docs.microsoft.com/en-us/graph/query-parameters
:param str attribute: attribute to apply the query for
:param Protocol protocol: protocol to use for connecting
| __init__ | python | O365/python-o365 | O365/utils/utils.py | https://github.com/O365/python-o365/blob/master/O365/utils/utils.py | Apache-2.0 |
def select(self, *attributes):
""" Adds the attribute to the $select parameter
:param str attributes: the attributes tuple to select.
If empty, the on_attribute previously set is added.
:rtype: Query
"""
if attributes:
for attribute in attributes:
... | Adds the attribute to the $select parameter
:param str attributes: the attributes tuple to select.
If empty, the on_attribute previously set is added.
:rtype: Query
| select | python | O365/python-o365 | O365/utils/utils.py | https://github.com/O365/python-o365/blob/master/O365/utils/utils.py | Apache-2.0 |
def expand(self, *relationships):
"""
Adds the relationships (e.g. "event" or "attachments")
that should be expanded with the $expand parameter
Important: The ApiComponent using this should know how to handle this relationships.
eg: Message knows how to handle attachments, a... |
Adds the relationships (e.g. "event" or "attachments")
that should be expanded with the $expand parameter
Important: The ApiComponent using this should know how to handle this relationships.
eg: Message knows how to handle attachments, and event (if it's an EventMessage)
I... | expand | python | O365/python-o365 | O365/utils/utils.py | https://github.com/O365/python-o365/blob/master/O365/utils/utils.py | Apache-2.0 |
def search(self, text):
"""
Perform a search.
Not from graph docs:
You can currently search only message and person collections.
A $search request returns up to 250 results.
You cannot use $filter or $orderby in a search request.
:param str text: the text to ... |
Perform a search.
Not from graph docs:
You can currently search only message and person collections.
A $search request returns up to 250 results.
You cannot use $filter or $orderby in a search request.
:param str text: the text to search
:return: the Query i... | search | python | O365/python-o365 | O365/utils/utils.py | https://github.com/O365/python-o365/blob/master/O365/utils/utils.py | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.