Merge pull request #632 from ucc/python_3.9_compat

Fix _is_valid_dkim_key for Python 3.9 compatibility in OVH provider
This commit is contained in:
Ross McFarland
2020-12-03 07:41:20 -08:00
committed by GitHub
2 changed files with 8 additions and 4 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [2.7, 3.7]
python-version: [2.7, 3.7, 3.9]
steps:
- uses: actions/checkout@master
- name: Setup python
+7 -3
View File
@@ -370,11 +370,15 @@ class OvhProvider(BaseProvider):
@staticmethod
def _is_valid_dkim_key(key):
result = True
base64_decode = getattr(base64, 'decodestring', None)
base64_decode = getattr(base64, 'decodebytes', base64_decode)
try:
base64.decodestring(bytearray(key, 'utf-8'))
result = base64_decode(bytearray(key, 'utf-8'))
except binascii.Error:
return False
return True
result = False
return result
def get_records(self, zone_name):
"""