Skip to content

Commit

Permalink
Bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
ecederstrand committed Oct 21, 2020
1 parent d9b815f commit 60ff7c3
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 33 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ Change Log

HEAD
----


3.3.1
-----
- Allow overriding `dns.resolver.Resolver` class attributes via `Autodiscovery.DNS_RESOLVER_ATTRS`.


Expand Down
17 changes: 15 additions & 2 deletions docs/exchangelib/autodiscover/discovery.html
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ <h1 class="title">Module <code>exchangelib.autodiscover.discovery</code></h1>
INITIAL_RETRY_POLICY = FailFast()
RETRY_WAIT = 10 # Seconds to wait before retry on connection errors
MAX_REDIRECTS = 10 # Maximum number of URL redirects before we give up
DNS_RESOLVER_ATTRS = {
&#39;timeout&#39;: AutodiscoverProtocol.TIMEOUT,
}

def __init__(self, email, credentials=None, auth_type=None, retry_policy=None):
&#34;&#34;&#34;
Expand Down Expand Up @@ -177,7 +180,8 @@ <h1 class="title">Module <code>exchangelib.autodiscover.discovery</code></h1>
@threaded_cached_property
def resolver(self):
resolver = dns.resolver.Resolver()
resolver.timeout = AutodiscoverProtocol.TIMEOUT
for k, v in self.DNS_RESOLVER_ATTRS.items():
setattr(resolver, k, v)
return resolver

def _build_response(self, ad_response):
Expand Down Expand Up @@ -715,6 +719,9 @@ <h2 id="args">Args</h2>
INITIAL_RETRY_POLICY = FailFast()
RETRY_WAIT = 10 # Seconds to wait before retry on connection errors
MAX_REDIRECTS = 10 # Maximum number of URL redirects before we give up
DNS_RESOLVER_ATTRS = {
&#39;timeout&#39;: AutodiscoverProtocol.TIMEOUT,
}

def __init__(self, email, credentials=None, auth_type=None, retry_policy=None):
&#34;&#34;&#34;
Expand Down Expand Up @@ -789,7 +796,8 @@ <h2 id="args">Args</h2>
@threaded_cached_property
def resolver(self):
resolver = dns.resolver.Resolver()
resolver.timeout = AutodiscoverProtocol.TIMEOUT
for k, v in self.DNS_RESOLVER_ATTRS.items():
setattr(resolver, k, v)
return resolver

def _build_response(self, ad_response):
Expand Down Expand Up @@ -1211,6 +1219,10 @@ <h2 id="args">Args</h2>
</details>
<h3>Class variables</h3>
<dl>
<dt id="exchangelib.autodiscover.discovery.Autodiscovery.DNS_RESOLVER_ATTRS"><code class="name">var <span class="ident">DNS_RESOLVER_ATTRS</span></code></dt>
<dd>
<div class="desc"></div>
</dd>
<dt id="exchangelib.autodiscover.discovery.Autodiscovery.INITIAL_RETRY_POLICY"><code class="name">var <span class="ident">INITIAL_RETRY_POLICY</span></code></dt>
<dd>
<div class="desc"></div>
Expand Down Expand Up @@ -1368,6 +1380,7 @@ <h1>Index</h1>
<li>
<h4><code><a title="exchangelib.autodiscover.discovery.Autodiscovery" href="#exchangelib.autodiscover.discovery.Autodiscovery">Autodiscovery</a></code></h4>
<ul class="">
<li><code><a title="exchangelib.autodiscover.discovery.Autodiscovery.DNS_RESOLVER_ATTRS" href="#exchangelib.autodiscover.discovery.Autodiscovery.DNS_RESOLVER_ATTRS">DNS_RESOLVER_ATTRS</a></code></li>
<li><code><a title="exchangelib.autodiscover.discovery.Autodiscovery.INITIAL_RETRY_POLICY" href="#exchangelib.autodiscover.discovery.Autodiscovery.INITIAL_RETRY_POLICY">INITIAL_RETRY_POLICY</a></code></li>
<li><code><a title="exchangelib.autodiscover.discovery.Autodiscovery.MAX_REDIRECTS" href="#exchangelib.autodiscover.discovery.Autodiscovery.MAX_REDIRECTS">MAX_REDIRECTS</a></code></li>
<li><code><a title="exchangelib.autodiscover.discovery.Autodiscovery.RETRY_WAIT" href="#exchangelib.autodiscover.discovery.Autodiscovery.RETRY_WAIT">RETRY_WAIT</a></code></li>
Expand Down
11 changes: 10 additions & 1 deletion docs/exchangelib/autodiscover/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,9 @@ <h2 id="args">Args</h2>
INITIAL_RETRY_POLICY = FailFast()
RETRY_WAIT = 10 # Seconds to wait before retry on connection errors
MAX_REDIRECTS = 10 # Maximum number of URL redirects before we give up
DNS_RESOLVER_ATTRS = {
&#39;timeout&#39;: AutodiscoverProtocol.TIMEOUT,
}

def __init__(self, email, credentials=None, auth_type=None, retry_policy=None):
&#34;&#34;&#34;
Expand Down Expand Up @@ -466,7 +469,8 @@ <h2 id="args">Args</h2>
@threaded_cached_property
def resolver(self):
resolver = dns.resolver.Resolver()
resolver.timeout = AutodiscoverProtocol.TIMEOUT
for k, v in self.DNS_RESOLVER_ATTRS.items():
setattr(resolver, k, v)
return resolver

def _build_response(self, ad_response):
Expand Down Expand Up @@ -888,6 +892,10 @@ <h2 id="args">Args</h2>
</details>
<h3>Class variables</h3>
<dl>
<dt id="exchangelib.autodiscover.Autodiscovery.DNS_RESOLVER_ATTRS"><code class="name">var <span class="ident">DNS_RESOLVER_ATTRS</span></code></dt>
<dd>
<div class="desc"></div>
</dd>
<dt id="exchangelib.autodiscover.Autodiscovery.INITIAL_RETRY_POLICY"><code class="name">var <span class="ident">INITIAL_RETRY_POLICY</span></code></dt>
<dd>
<div class="desc"></div>
Expand Down Expand Up @@ -1042,6 +1050,7 @@ <h4><code><a title="exchangelib.autodiscover.AutodiscoverProtocol" href="#exchan
<li>
<h4><code><a title="exchangelib.autodiscover.Autodiscovery" href="#exchangelib.autodiscover.Autodiscovery">Autodiscovery</a></code></h4>
<ul class="">
<li><code><a title="exchangelib.autodiscover.Autodiscovery.DNS_RESOLVER_ATTRS" href="#exchangelib.autodiscover.Autodiscovery.DNS_RESOLVER_ATTRS">DNS_RESOLVER_ATTRS</a></code></li>
<li><code><a title="exchangelib.autodiscover.Autodiscovery.INITIAL_RETRY_POLICY" href="#exchangelib.autodiscover.Autodiscovery.INITIAL_RETRY_POLICY">INITIAL_RETRY_POLICY</a></code></li>
<li><code><a title="exchangelib.autodiscover.Autodiscovery.MAX_REDIRECTS" href="#exchangelib.autodiscover.Autodiscovery.MAX_REDIRECTS">MAX_REDIRECTS</a></code></li>
<li><code><a title="exchangelib.autodiscover.Autodiscovery.RETRY_WAIT" href="#exchangelib.autodiscover.Autodiscovery.RETRY_WAIT">RETRY_WAIT</a></code></li>
Expand Down
19 changes: 6 additions & 13 deletions docs/exchangelib/ewsdatetime.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ <h1 class="title">Module <code>exchangelib.ewsdatetime</code></h1>
import logging
import warnings

import dateutil.parser
try:
import zoneinfo
except ImportError:
Expand Down Expand Up @@ -176,10 +175,8 @@ <h1 class="title">Module <code>exchangelib.ewsdatetime</code></h1>
# This is probably a naive datetime. Don&#39;t allow this, but signal caller with an appropriate error
local_dt = super().strptime(date_string, &#39;%Y-%m-%dT%H:%M:%S&#39;)
raise NaiveDateTimeNotAllowed(local_dt)
# This is probably a datetime value with timezone information. This comes in the form &#39;+/-HH:MM&#39; but the Python
# strptime &#39;%z&#39; directive cannot yet handle full ISO8601 formatted timezone information (see
# http://bugs.python.org/issue15873). Use the &#39;dateutil&#39; package instead.
aware_dt = dateutil.parser.parse(date_string).astimezone(UTC).replace(tzinfo=UTC)
# This is probably a datetime value with timezone information. This comes in the form &#39;+/-HH:MM&#39;.
aware_dt = datetime.datetime.fromisoformat(date_string).astimezone(UTC).replace(tzinfo=UTC)
if isinstance(aware_dt, cls):
return aware_dt
return cls.from_datetime(aware_dt)
Expand Down Expand Up @@ -581,10 +578,8 @@ <h3>Methods</h3>
# This is probably a naive datetime. Don&#39;t allow this, but signal caller with an appropriate error
local_dt = super().strptime(date_string, &#39;%Y-%m-%dT%H:%M:%S&#39;)
raise NaiveDateTimeNotAllowed(local_dt)
# This is probably a datetime value with timezone information. This comes in the form &#39;+/-HH:MM&#39; but the Python
# strptime &#39;%z&#39; directive cannot yet handle full ISO8601 formatted timezone information (see
# http://bugs.python.org/issue15873). Use the &#39;dateutil&#39; package instead.
aware_dt = dateutil.parser.parse(date_string).astimezone(UTC).replace(tzinfo=UTC)
# This is probably a datetime value with timezone information. This comes in the form &#39;+/-HH:MM&#39;.
aware_dt = datetime.datetime.fromisoformat(date_string).astimezone(UTC).replace(tzinfo=UTC)
if isinstance(aware_dt, cls):
return aware_dt
return cls.from_datetime(aware_dt)
Expand Down Expand Up @@ -671,10 +666,8 @@ <h3>Static methods</h3>
# This is probably a naive datetime. Don&#39;t allow this, but signal caller with an appropriate error
local_dt = super().strptime(date_string, &#39;%Y-%m-%dT%H:%M:%S&#39;)
raise NaiveDateTimeNotAllowed(local_dt)
# This is probably a datetime value with timezone information. This comes in the form &#39;+/-HH:MM&#39; but the Python
# strptime &#39;%z&#39; directive cannot yet handle full ISO8601 formatted timezone information (see
# http://bugs.python.org/issue15873). Use the &#39;dateutil&#39; package instead.
aware_dt = dateutil.parser.parse(date_string).astimezone(UTC).replace(tzinfo=UTC)
# This is probably a datetime value with timezone information. This comes in the form &#39;+/-HH:MM&#39;.
aware_dt = datetime.datetime.fromisoformat(date_string).astimezone(UTC).replace(tzinfo=UTC)
if isinstance(aware_dt, cls):
return aware_dt
return cls.from_datetime(aware_dt)</code></pre>
Expand Down
10 changes: 4 additions & 6 deletions docs/exchangelib/fields.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ <h1 class="title">Module <code>exchangelib.fields</code></h1>
from importlib import import_module
import logging

import dateutil.parser

from .errors import ErrorInvalidServerVersion
from .ewsdatetime import EWSDateTime, EWSDate, EWSTimeZone, NaiveDateTimeNotAllowed, UnknownTimeZone, UTC
from .util import create_element, get_xml_attrs, set_xml_value, value_to_xml_text, is_iterable, safe_b64decode, TNS
Expand Down Expand Up @@ -666,7 +664,7 @@ <h1 class="title">Module <code>exchangelib.fields</code></h1>
# before converting to date. EWSDateTime.from_string() insists on converting to UTC, but we don&#39;t have an
# EWSTimeZone we can convert the timezone info to. Instead, parse the string manually when we have a
# datetime string with timezone info.
return EWSDate.from_date(dateutil.parser.parse(val).date())
return EWSDate.from_date(datetime.datetime.fromisoformat(val).date())
# Revert to default parsing of datetime strings
res = self._datetime_field.from_xml(elem=elem, account=account)
if res is None:
Expand Down Expand Up @@ -2846,7 +2844,7 @@ <h3>Inherited members</h3>
# before converting to date. EWSDateTime.from_string() insists on converting to UTC, but we don&#39;t have an
# EWSTimeZone we can convert the timezone info to. Instead, parse the string manually when we have a
# datetime string with timezone info.
return EWSDate.from_date(dateutil.parser.parse(val).date())
return EWSDate.from_date(datetime.datetime.fromisoformat(val).date())
# Revert to default parsing of datetime strings
res = self._datetime_field.from_xml(elem=elem, account=account)
if res is None:
Expand Down Expand Up @@ -2901,7 +2899,7 @@ <h3>Methods</h3>
# before converting to date. EWSDateTime.from_string() insists on converting to UTC, but we don&#39;t have an
# EWSTimeZone we can convert the timezone info to. Instead, parse the string manually when we have a
# datetime string with timezone info.
return EWSDate.from_date(dateutil.parser.parse(val).date())
return EWSDate.from_date(datetime.datetime.fromisoformat(val).date())
# Revert to default parsing of datetime strings
res = self._datetime_field.from_xml(elem=elem, account=account)
if res is None:
Expand Down Expand Up @@ -4810,7 +4808,7 @@ <h3>Class variables</h3>
The base defaults to 10.
Valid bases are 0 and 2-36.
Base 0 means to interpret the base from the string as an integer literal.</p>
<pre><code class="python-repl">&gt;&gt;&gt; int('0b100', base=0)
<pre><code class="language-python-repl">&gt;&gt;&gt; int('0b100', base=0)
4
</code></pre></div>
</dd>
Expand Down
23 changes: 13 additions & 10 deletions docs/exchangelib/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ <h1 class="title">Package <code>exchangelib</code></h1>
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">from .account import Account, Identity
<pre><code class="python">import sys

from .account import Account, Identity
from .attachments import FileAttachment, ItemAttachment
from .autodiscover import discover
from .configuration import Configuration
Expand All @@ -44,7 +46,7 @@ <h1 class="title">Package <code>exchangelib</code></h1>
from .transport import BASIC, DIGEST, NTLM, GSSAPI, SSPI, OAUTH2, CBA
from .version import Build, Version

__version__ = &#39;3.3.0&#39;
__version__ = &#39;3.3.1&#39;

__all__ = [
&#39;__version__&#39;,
Expand All @@ -70,6 +72,11 @@ <h1 class="title">Package <code>exchangelib</code></h1>
import requests.utils
BaseProtocol.USERAGENT = &#34;%s/%s (%s)&#34; % (__name__, __version__, requests.utils.default_user_agent())

# Support fromisoformat() in Python &lt; 3.7
if sys.version_info[:2] &lt; (3, 7):
from backports.datetime_fromisoformat import MonkeyPatch
MonkeyPatch.patch_fromisoformat()


def close_connections():
from .autodiscover import close_connections as close_autodiscover_connections
Expand Down Expand Up @@ -5463,10 +5470,8 @@ <h3>Methods</h3>
# This is probably a naive datetime. Don&#39;t allow this, but signal caller with an appropriate error
local_dt = super().strptime(date_string, &#39;%Y-%m-%dT%H:%M:%S&#39;)
raise NaiveDateTimeNotAllowed(local_dt)
# This is probably a datetime value with timezone information. This comes in the form &#39;+/-HH:MM&#39; but the Python
# strptime &#39;%z&#39; directive cannot yet handle full ISO8601 formatted timezone information (see
# http://bugs.python.org/issue15873). Use the &#39;dateutil&#39; package instead.
aware_dt = dateutil.parser.parse(date_string).astimezone(UTC).replace(tzinfo=UTC)
# This is probably a datetime value with timezone information. This comes in the form &#39;+/-HH:MM&#39;.
aware_dt = datetime.datetime.fromisoformat(date_string).astimezone(UTC).replace(tzinfo=UTC)
if isinstance(aware_dt, cls):
return aware_dt
return cls.from_datetime(aware_dt)
Expand Down Expand Up @@ -5553,10 +5558,8 @@ <h3>Static methods</h3>
# This is probably a naive datetime. Don&#39;t allow this, but signal caller with an appropriate error
local_dt = super().strptime(date_string, &#39;%Y-%m-%dT%H:%M:%S&#39;)
raise NaiveDateTimeNotAllowed(local_dt)
# This is probably a datetime value with timezone information. This comes in the form &#39;+/-HH:MM&#39; but the Python
# strptime &#39;%z&#39; directive cannot yet handle full ISO8601 formatted timezone information (see
# http://bugs.python.org/issue15873). Use the &#39;dateutil&#39; package instead.
aware_dt = dateutil.parser.parse(date_string).astimezone(UTC).replace(tzinfo=UTC)
# This is probably a datetime value with timezone information. This comes in the form &#39;+/-HH:MM&#39;.
aware_dt = datetime.datetime.fromisoformat(date_string).astimezone(UTC).replace(tzinfo=UTC)
if isinstance(aware_dt, cls):
return aware_dt
return cls.from_datetime(aware_dt)</code></pre>
Expand Down
2 changes: 1 addition & 1 deletion exchangelib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from .transport import BASIC, DIGEST, NTLM, GSSAPI, SSPI, OAUTH2, CBA
from .version import Build, Version

__version__ = '3.3.0'
__version__ = '3.3.1'

__all__ = [
'__version__',
Expand Down

0 comments on commit 60ff7c3

Please sign in to comment.