Add USE_ASYNC flag to allow async to be disabled when aiodns is
installed (LP: #1954331) - see README.md for details
This commit is contained in:
@@ -13,6 +13,8 @@ Version 1.1
|
||||
- Add support for PKCS#8 for private keys, openssl 3 default (LP:
|
||||
#1978835) - Thanks to Adrien (spitap) for the change
|
||||
- Add limitations section to README to document current IDN status
|
||||
- Add USE_ASYNC flag to allow async to be disabled when aiodns is
|
||||
installed (LP: #1954331) - see README.md for details
|
||||
|
||||
2019-12-31 Version 1.0.2
|
||||
- dknewkey: On posix operating systems set file permissions to 600 for
|
||||
|
||||
@@ -197,6 +197,9 @@ Here is a simple example of dkim.verify_async usage:
|
||||
|
||||
This feature requires python3.5 or newer.
|
||||
|
||||
If aiodns is available, the async functions will be used. To avoide async
|
||||
when aiodns is availale, set dkim.USE_ASYNC = False.
|
||||
|
||||
## TLSRPT (TLS Report)
|
||||
|
||||
As of version 1.0, the RFC 8460 tlsrpt service type is supported:
|
||||
|
||||
+9
-1
@@ -40,6 +40,9 @@ import sys
|
||||
import time
|
||||
import binascii
|
||||
|
||||
# Set to False to not use async functions even though aiodns is installed.
|
||||
USE_ASYNC = True
|
||||
|
||||
# only needed for arc
|
||||
try:
|
||||
from authres import AuthenticationResultsHeader
|
||||
@@ -72,6 +75,7 @@ from dkim.crypto import (
|
||||
try:
|
||||
from dkim.dnsplug import get_txt
|
||||
except ImportError:
|
||||
if USE_ASYNC:
|
||||
try:
|
||||
import aiodns
|
||||
from dkim.asyncsupport import get_txt_async as get_txt
|
||||
@@ -79,6 +83,9 @@ except ImportError:
|
||||
# Only true if not using async
|
||||
def get_txt(s,timeout=5):
|
||||
raise RuntimeError("DKIM.verify requires DNS or dnspython module")
|
||||
else:
|
||||
raise RuntimeError("DKIM.verify requires DNS or dnspython module")
|
||||
|
||||
from dkim.util import (
|
||||
get_default_logger,
|
||||
InvalidTagValueList,
|
||||
@@ -94,6 +101,7 @@ __all__ = [
|
||||
"ValidationError",
|
||||
"AuthresNotFoundError",
|
||||
"NaClNotFoundError",
|
||||
"USE_ASYNC",
|
||||
"CV_Pass",
|
||||
"CV_Fail",
|
||||
"CV_None",
|
||||
@@ -1369,7 +1377,7 @@ def verify(message, logger=None, dnsfunc=get_txt, minkey=1024,
|
||||
|
||||
|
||||
# aiodns requires Python 3.5+, so no async before that
|
||||
if sys.version_info >= (3, 5):
|
||||
if sys.version_info >= (3, 5) and USE_ASYNC:
|
||||
try:
|
||||
import aiodns
|
||||
from dkim.asyncsupport import verify_async
|
||||
|
||||
Reference in New Issue
Block a user