diff --git a/docs/exchangelib/autodiscover/discovery.html b/docs/exchangelib/autodiscover/discovery.html index 9054f269..e7a5801b 100644 --- a/docs/exchangelib/autodiscover/discovery.html +++ b/docs/exchangelib/autodiscover/discovery.html @@ -116,8 +116,9 @@

Module exchangelib.autodiscover.discovery

MAX_REDIRECTS = 10 # Maximum number of URL redirects before we give up DNS_RESOLVER_KWARGS = {} DNS_RESOLVER_ATTRS = { - "timeout": AutodiscoverProtocol.TIMEOUT, + "timeout": AutodiscoverProtocol.TIMEOUT / 2.5, # Timeout for query to a single nameserver } + DNS_RESOLVER_LIFETIME = AutodiscoverProtocol.TIMEOUT # Total timeout for a query in case of multiple nameservers def __init__(self, email, credentials=None): """ @@ -392,7 +393,7 @@

Module exchangelib.autodiscover.discovery

def _is_valid_hostname(self, hostname): log.debug("Checking if %s can be looked up in DNS", hostname) try: - self.resolver.resolve(f"{hostname}.", "A", lifetime=self.DNS_RESOLVER_ATTRS.get("timeout")) + self.resolver.resolve(f"{hostname}.", "A", lifetime=self.DNS_RESOLVER_LIFETIME) except DNS_LOOKUP_ERRORS as e: log.debug("DNS A lookup failure: %s", e) return False @@ -414,7 +415,7 @@

Module exchangelib.autodiscover.discovery

log.debug("Attempting to get SRV records for %s", hostname) records = [] try: - answers = self.resolver.resolve(f"{hostname}.", "SRV", lifetime=self.DNS_RESOLVER_ATTRS.get("timeout")) + answers = self.resolver.resolve(f"{hostname}.", "SRV", lifetime=self.DNS_RESOLVER_LIFETIME) except DNS_LOOKUP_ERRORS as e: log.debug("DNS SRV lookup failure: %s", e) return records @@ -691,8 +692,9 @@

Classes

MAX_REDIRECTS = 10 # Maximum number of URL redirects before we give up DNS_RESOLVER_KWARGS = {} DNS_RESOLVER_ATTRS = { - "timeout": AutodiscoverProtocol.TIMEOUT, + "timeout": AutodiscoverProtocol.TIMEOUT / 2.5, # Timeout for query to a single nameserver } + DNS_RESOLVER_LIFETIME = AutodiscoverProtocol.TIMEOUT # Total timeout for a query in case of multiple nameservers def __init__(self, email, credentials=None): """ @@ -967,7 +969,7 @@

Classes

def _is_valid_hostname(self, hostname): log.debug("Checking if %s can be looked up in DNS", hostname) try: - self.resolver.resolve(f"{hostname}.", "A", lifetime=self.DNS_RESOLVER_ATTRS.get("timeout")) + self.resolver.resolve(f"{hostname}.", "A", lifetime=self.DNS_RESOLVER_LIFETIME) except DNS_LOOKUP_ERRORS as e: log.debug("DNS A lookup failure: %s", e) return False @@ -989,7 +991,7 @@

Classes

log.debug("Attempting to get SRV records for %s", hostname) records = [] try: - answers = self.resolver.resolve(f"{hostname}.", "SRV", lifetime=self.DNS_RESOLVER_ATTRS.get("timeout")) + answers = self.resolver.resolve(f"{hostname}.", "SRV", lifetime=self.DNS_RESOLVER_LIFETIME) except DNS_LOOKUP_ERRORS as e: log.debug("DNS SRV lookup failure: %s", e) return records @@ -1166,6 +1168,10 @@

Class variables

+
var DNS_RESOLVER_LIFETIME
+
+
+
var INITIAL_RETRY_POLICY
@@ -1323,6 +1329,7 @@

  • DNS_RESOLVER_ATTRS
  • DNS_RESOLVER_KWARGS
  • +
  • DNS_RESOLVER_LIFETIME
  • INITIAL_RETRY_POLICY
  • MAX_REDIRECTS
  • RETRY_WAIT
  • @@ -1343,4 +1350,4 @@

    pdoc 0.10.0.

    - \ No newline at end of file + diff --git a/docs/exchangelib/autodiscover/index.html b/docs/exchangelib/autodiscover/index.html index abc9faa0..3c8c9c9d 100644 --- a/docs/exchangelib/autodiscover/index.html +++ b/docs/exchangelib/autodiscover/index.html @@ -389,8 +389,9 @@

    Inherited members

    MAX_REDIRECTS = 10 # Maximum number of URL redirects before we give up DNS_RESOLVER_KWARGS = {} DNS_RESOLVER_ATTRS = { - "timeout": AutodiscoverProtocol.TIMEOUT, + "timeout": AutodiscoverProtocol.TIMEOUT / 2.5, # Timeout for query to a single nameserver } + DNS_RESOLVER_LIFETIME = AutodiscoverProtocol.TIMEOUT # Total timeout for a query in case of multiple nameservers def __init__(self, email, credentials=None): """ @@ -665,7 +666,7 @@

    Inherited members

    def _is_valid_hostname(self, hostname): log.debug("Checking if %s can be looked up in DNS", hostname) try: - self.resolver.resolve(f"{hostname}.", "A", lifetime=self.DNS_RESOLVER_ATTRS.get("timeout")) + self.resolver.resolve(f"{hostname}.", "A", lifetime=self.DNS_RESOLVER_LIFETIME) except DNS_LOOKUP_ERRORS as e: log.debug("DNS A lookup failure: %s", e) return False @@ -687,7 +688,7 @@

    Inherited members

    log.debug("Attempting to get SRV records for %s", hostname) records = [] try: - answers = self.resolver.resolve(f"{hostname}.", "SRV", lifetime=self.DNS_RESOLVER_ATTRS.get("timeout")) + answers = self.resolver.resolve(f"{hostname}.", "SRV", lifetime=self.DNS_RESOLVER_LIFETIME) except DNS_LOOKUP_ERRORS as e: log.debug("DNS SRV lookup failure: %s", e) return records @@ -864,6 +865,10 @@

    Class variables

    +
    var DNS_RESOLVER_LIFETIME
    +
    +
    +
    var INITIAL_RETRY_POLICY
    @@ -1021,6 +1026,7 @@

  • DNS_RESOLVER_ATTRS
  • DNS_RESOLVER_KWARGS
  • +
  • DNS_RESOLVER_LIFETIME
  • INITIAL_RETRY_POLICY
  • MAX_REDIRECTS
  • RETRY_WAIT
  • @@ -1038,4 +1044,4 @@

    pdoc 0.10.0.

    - \ No newline at end of file + diff --git a/docs/exchangelib/index.html b/docs/exchangelib/index.html index 77d1859a..4302b105 100644 --- a/docs/exchangelib/index.html +++ b/docs/exchangelib/index.html @@ -57,7 +57,7 @@

    Package exchangelib

    from .transport import BASIC, CBA, DIGEST, GSSAPI, NTLM, OAUTH2, SSPI from .version import Build, Version -__version__ = "4.7.4" +__version__ = "4.7.5" __all__ = [ "__version__", @@ -2870,8 +2870,12 @@

    Inherited members

    session = self.renew_session(session) self._session_pool.put(session, block=False) - @staticmethod - def close_session(session): + def close_session(self, session): + if isinstance(self.credentials, OAuth2Credentials) and not isinstance( + self.credentials, OAuth2AuthorizationCodeCredentials + ): + # Reset token if client is of type BackendApplicationClient + self.credentials.access_token = None session.close() del session @@ -3051,21 +3055,6 @@

    Class variables

    Static methods

    -
    -def close_session(session) -
    -
    -
    -
    - -Expand source code - -
    @staticmethod
    -def close_session(session):
    -    session.close()
    -    del session
    -
    -
    def get_adapter()
    @@ -3208,6 +3197,25 @@

    Methods

    break

    +
    +def close_session(self, session) +
    +
    +
    +
    + +Expand source code + +
    def close_session(self, session):
    +    if isinstance(self.credentials, OAuth2Credentials) and not isinstance(
    +        self.credentials, OAuth2AuthorizationCodeCredentials
    +    ):
    +        # Reset token if client is of type BackendApplicationClient
    +        self.credentials.access_token = None
    +    session.close()
    +    del session
    +
    +
    def create_oauth2_session(self)
    diff --git a/docs/exchangelib/protocol.html b/docs/exchangelib/protocol.html index 21306507..cece96d0 100644 --- a/docs/exchangelib/protocol.html +++ b/docs/exchangelib/protocol.html @@ -276,8 +276,12 @@

    Module exchangelib.protocol

    session = self.renew_session(session) self._session_pool.put(session, block=False) - @staticmethod - def close_session(session): + def close_session(self, session): + if isinstance(self.credentials, OAuth2Credentials) and not isinstance( + self.credentials, OAuth2AuthorizationCodeCredentials + ): + # Reset token if client is of type BackendApplicationClient + self.credentials.access_token = None session.close() del session @@ -533,7 +537,6 @@

    Module exchangelib.protocol

    tz_definition = list(self.get_timezones(timezones=[start.tzinfo], return_full_timezone_data=True))[0] return GetUserAvailability(self).call( - timezone=TimeZone.from_server_timezone(tz_definition=tz_definition, for_year=start.year), mailbox_data=[ MailboxData( email=account.primary_smtp_address if isinstance(account, Account) else account, @@ -542,6 +545,7 @@

    Module exchangelib.protocol

    ) for account, attendee_type, exclude_conflicts in accounts ], + timezone=TimeZone.from_server_timezone(tz_definition=tz_definition, for_year=start.year), free_busy_view_options=FreeBusyViewOptions( time_window=TimeWindow(start=start, end=end), merged_free_busy_interval=merged_free_busy_interval, @@ -1054,8 +1058,12 @@

    Classes

    session = self.renew_session(session) self._session_pool.put(session, block=False) - @staticmethod - def close_session(session): + def close_session(self, session): + if isinstance(self.credentials, OAuth2Credentials) and not isinstance( + self.credentials, OAuth2AuthorizationCodeCredentials + ): + # Reset token if client is of type BackendApplicationClient + self.credentials.access_token = None session.close() del session @@ -1235,21 +1243,6 @@

    Class variables

    Static methods

    -
    -def close_session(session) -
    -
    -
    -
    - -Expand source code - -
    @staticmethod
    -def close_session(session):
    -    session.close()
    -    del session
    -
    -
    def get_adapter()
    @@ -1392,6 +1385,25 @@

    Methods

    break

    +
    +def close_session(self, session) +
    +
    +
    +
    + +Expand source code + +
    def close_session(self, session):
    +    if isinstance(self.credentials, OAuth2Credentials) and not isinstance(
    +        self.credentials, OAuth2AuthorizationCodeCredentials
    +    ):
    +        # Reset token if client is of type BackendApplicationClient
    +        self.credentials.access_token = None
    +    session.close()
    +    del session
    +
    +
    def create_oauth2_session(self)
    @@ -2103,7 +2115,6 @@

    Methods

    tz_definition = list(self.get_timezones(timezones=[start.tzinfo], return_full_timezone_data=True))[0] return GetUserAvailability(self).call( - timezone=TimeZone.from_server_timezone(tz_definition=tz_definition, for_year=start.year), mailbox_data=[ MailboxData( email=account.primary_smtp_address if isinstance(account, Account) else account, @@ -2112,6 +2123,7 @@

    Methods

    ) for account, attendee_type, exclude_conflicts in accounts ], + timezone=TimeZone.from_server_timezone(tz_definition=tz_definition, for_year=start.year), free_busy_view_options=FreeBusyViewOptions( time_window=TimeWindow(start=start, end=end), merged_free_busy_interval=merged_free_busy_interval, @@ -2319,7 +2331,6 @@

    Methods

    tz_definition = list(self.get_timezones(timezones=[start.tzinfo], return_full_timezone_data=True))[0] return GetUserAvailability(self).call( - timezone=TimeZone.from_server_timezone(tz_definition=tz_definition, for_year=start.year), mailbox_data=[ MailboxData( email=account.primary_smtp_address if isinstance(account, Account) else account, @@ -2328,6 +2339,7 @@

    Methods

    ) for account, attendee_type, exclude_conflicts in accounts ], + timezone=TimeZone.from_server_timezone(tz_definition=tz_definition, for_year=start.year), free_busy_view_options=FreeBusyViewOptions( time_window=TimeWindow(start=start, end=end), merged_free_busy_interval=merged_free_busy_interval, diff --git a/docs/exchangelib/services/get_user_availability.html b/docs/exchangelib/services/get_user_availability.html index 6e1a0d84..43242e03 100644 --- a/docs/exchangelib/services/get_user_availability.html +++ b/docs/exchangelib/services/get_user_availability.html @@ -39,21 +39,22 @@

    Module exchangelib.services.get_user_availability SERVICE_NAME = "GetUserAvailability" - def call(self, timezone, mailbox_data, free_busy_view_options): + def call(self, mailbox_data, timezone, free_busy_view_options): # TODO: Also supports SuggestionsViewOptions, see # https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/suggestionsviewoptions return self._elems_to_objs( - self._get_elements( - payload=self.get_payload( - timezone=timezone, mailbox_data=mailbox_data, free_busy_view_options=free_busy_view_options - ) + self._chunked_get_elements( + self.get_payload, + items=mailbox_data, + timezone=timezone, + free_busy_view_options=free_busy_view_options, ) ) def _elem_to_obj(self, elem): return FreeBusyView.from_xml(elem=elem, account=None) - def get_payload(self, timezone, mailbox_data, free_busy_view_options): + def get_payload(self, mailbox_data, timezone, free_busy_view_options): payload = create_element(f"m:{self.SERVICE_NAME}Request") set_xml_value(payload, timezone, version=self.protocol.version) mailbox_data_array = create_element("m:MailboxDataArray") @@ -111,21 +112,22 @@

    Classes

    SERVICE_NAME = "GetUserAvailability" - def call(self, timezone, mailbox_data, free_busy_view_options): + def call(self, mailbox_data, timezone, free_busy_view_options): # TODO: Also supports SuggestionsViewOptions, see # https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/suggestionsviewoptions return self._elems_to_objs( - self._get_elements( - payload=self.get_payload( - timezone=timezone, mailbox_data=mailbox_data, free_busy_view_options=free_busy_view_options - ) + self._chunked_get_elements( + self.get_payload, + items=mailbox_data, + timezone=timezone, + free_busy_view_options=free_busy_view_options, ) ) def _elem_to_obj(self, elem): return FreeBusyView.from_xml(elem=elem, account=None) - def get_payload(self, timezone, mailbox_data, free_busy_view_options): + def get_payload(self, mailbox_data, timezone, free_busy_view_options): payload = create_element(f"m:{self.SERVICE_NAME}Request") set_xml_value(payload, timezone, version=self.protocol.version) mailbox_data_array = create_element("m:MailboxDataArray") @@ -167,7 +169,7 @@

    Class variables

    Methods

    -def call(self, timezone, mailbox_data, free_busy_view_options) +def call(self, mailbox_data, timezone, free_busy_view_options)
    @@ -175,20 +177,21 @@

    Methods

    Expand source code -
    def call(self, timezone, mailbox_data, free_busy_view_options):
    +
    def call(self, mailbox_data, timezone, free_busy_view_options):
         # TODO: Also supports SuggestionsViewOptions, see
         #  https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/suggestionsviewoptions
         return self._elems_to_objs(
    -        self._get_elements(
    -            payload=self.get_payload(
    -                timezone=timezone, mailbox_data=mailbox_data, free_busy_view_options=free_busy_view_options
    -            )
    +        self._chunked_get_elements(
    +            self.get_payload,
    +            items=mailbox_data,
    +            timezone=timezone,
    +            free_busy_view_options=free_busy_view_options,
             )
         )
    -def get_payload(self, timezone, mailbox_data, free_busy_view_options) +def get_payload(self, mailbox_data, timezone, free_busy_view_options)
    @@ -196,7 +199,7 @@

    Methods

    Expand source code -
    def get_payload(self, timezone, mailbox_data, free_busy_view_options):
    +
    def get_payload(self, mailbox_data, timezone, free_busy_view_options):
         payload = create_element(f"m:{self.SERVICE_NAME}Request")
         set_xml_value(payload, timezone, version=self.protocol.version)
         mailbox_data_array = create_element("m:MailboxDataArray")
    @@ -251,4 +254,4 @@ 

    pdoc 0.10.0.

    - \ No newline at end of file + diff --git a/docs/exchangelib/services/index.html b/docs/exchangelib/services/index.html index 59812f89..e9ba41b8 100644 --- a/docs/exchangelib/services/index.html +++ b/docs/exchangelib/services/index.html @@ -4193,21 +4193,22 @@

    Inherited members

    SERVICE_NAME = "GetUserAvailability" - def call(self, timezone, mailbox_data, free_busy_view_options): + def call(self, mailbox_data, timezone, free_busy_view_options): # TODO: Also supports SuggestionsViewOptions, see # https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/suggestionsviewoptions return self._elems_to_objs( - self._get_elements( - payload=self.get_payload( - timezone=timezone, mailbox_data=mailbox_data, free_busy_view_options=free_busy_view_options - ) + self._chunked_get_elements( + self.get_payload, + items=mailbox_data, + timezone=timezone, + free_busy_view_options=free_busy_view_options, ) ) def _elem_to_obj(self, elem): return FreeBusyView.from_xml(elem=elem, account=None) - def get_payload(self, timezone, mailbox_data, free_busy_view_options): + def get_payload(self, mailbox_data, timezone, free_busy_view_options): payload = create_element(f"m:{self.SERVICE_NAME}Request") set_xml_value(payload, timezone, version=self.protocol.version) mailbox_data_array = create_element("m:MailboxDataArray") @@ -4249,7 +4250,7 @@

    Class variables

    Methods

    -def call(self, timezone, mailbox_data, free_busy_view_options) +def call(self, mailbox_data, timezone, free_busy_view_options)
    @@ -4257,20 +4258,21 @@

    Methods

    Expand source code -
    def call(self, timezone, mailbox_data, free_busy_view_options):
    +
    def call(self, mailbox_data, timezone, free_busy_view_options):
         # TODO: Also supports SuggestionsViewOptions, see
         #  https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/suggestionsviewoptions
         return self._elems_to_objs(
    -        self._get_elements(
    -            payload=self.get_payload(
    -                timezone=timezone, mailbox_data=mailbox_data, free_busy_view_options=free_busy_view_options
    -            )
    +        self._chunked_get_elements(
    +            self.get_payload,
    +            items=mailbox_data,
    +            timezone=timezone,
    +            free_busy_view_options=free_busy_view_options,
             )
         )
    -def get_payload(self, timezone, mailbox_data, free_busy_view_options) +def get_payload(self, mailbox_data, timezone, free_busy_view_options)
    @@ -4278,7 +4280,7 @@

    Methods

    Expand source code -
    def get_payload(self, timezone, mailbox_data, free_busy_view_options):
    +
    def get_payload(self, mailbox_data, timezone, free_busy_view_options):
         payload = create_element(f"m:{self.SERVICE_NAME}Request")
         set_xml_value(payload, timezone, version=self.protocol.version)
         mailbox_data_array = create_element("m:MailboxDataArray")
    diff --git a/docs/exchangelib/util.html b/docs/exchangelib/util.html
    index 9e0959bc..b482deee 100644
    --- a/docs/exchangelib/util.html
    +++ b/docs/exchangelib/util.html
    @@ -601,8 +601,7 @@ 

    Module exchangelib.util

    class PrettyXmlHandler(logging.StreamHandler): """A steaming log handler that prettifies log statements containing XML when output is a terminal.""" - @staticmethod - def parse_bytes(xml_bytes): + def parse_bytes(self, xml_bytes): return to_xml(xml_bytes) @classmethod @@ -2224,8 +2223,7 @@

    Ancestors

    class PrettyXmlHandler(logging.StreamHandler):
         """A steaming log handler that prettifies log statements containing XML when output is a terminal."""
     
    -    @staticmethod
    -    def parse_bytes(xml_bytes):
    +    def parse_bytes(self, xml_bytes):
             return to_xml(xml_bytes)
     
         @classmethod
    @@ -2299,20 +2297,6 @@ 

    Static methods

    return highlight(xml_str, XmlLexer(), TerminalFormatter()).rstrip()
    -
    -def parse_bytes(xml_bytes) -
    -
    -
    -
    - -Expand source code - -
    @staticmethod
    -def parse_bytes(xml_bytes):
    -    return to_xml(xml_bytes)
    -
    -
    def prettify_xml(xml_bytes)
    @@ -2389,6 +2373,19 @@

    Methods

    return False

    +
    +def parse_bytes(self, xml_bytes) +
    +
    +
    +
    + +Expand source code + +
    def parse_bytes(self, xml_bytes):
    +    return to_xml(xml_bytes)
    +
    +
    @@ -2729,4 +2726,4 @@

    pdoc 0.10.0.

    - \ No newline at end of file +