Skip to content

Commit

Permalink
Version 3.15.0
Browse files Browse the repository at this point in the history
  • Loading branch information
adferrand committed Sep 30, 2023
1 parent 7c6a324 commit f790273
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Changelog

## master - CURRENT

## 3.15.0 - 30/09/2023
### Added
* Add `pyotp` Python dependency in Lexicon to help implementing OTP (one-time password)
on providers whose API supports this kind of authentication.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "dns-lexicon"
version = "3.14.1"
version = "3.15.0"
description = "Manipulate DNS records on various DNS providers in a standardized/agnostic way"
license = "MIT"
keywords = [
Expand Down
3 changes: 2 additions & 1 deletion src/lexicon/_private/providers/auto.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
"""Module provider for auto"""
from __future__ import annotations

import logging
import pkgutil
import re
import subprocess
from argparse import ArgumentParser
from types import ModuleType
from typing import Type, Any
from typing import Any, Type

import tldextract # type: ignore

Expand Down
10 changes: 8 additions & 2 deletions src/lexicon/_private/providers/hover.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ def __init__(self, config):
self.domain_id = None
self.api_endpoint = "https://www.hover.com/api"
self.cookies = {}
shared_secret = re.sub(r"\s*", "", self._get_provider_option("auth_totp_secret") or "")
shared_secret = re.sub(
r"\s*", "", self._get_provider_option("auth_totp_secret") or ""
)
self.totp = pyotp.TOTP(shared_secret)

def authenticate(self) -> None:
Expand Down Expand Up @@ -191,7 +193,11 @@ def delete_record(self, identifier=None, rtype=None, name=None, content=None):
delete_record_ids.append(identifier)

LOGGER.debug("delete_records: %s", delete_record_ids)
payload = {"domains": [{"id": f"domain-{self.domain}", "dns_records": delete_record_ids}]}
payload = {
"domains": [
{"id": f"domain-{self.domain}", "dns_records": delete_record_ids}
]
}
self._request("DELETE", "/control_panel/dns", payload)

return True
Expand Down
6 changes: 4 additions & 2 deletions src/lexicon/_private/providers/valuedomain.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,11 +553,13 @@ def tearDown(self):
pass

def _create_provider(self, domainname: str):
config = ConfigResolver().with_dict({
config = ConfigResolver().with_dict(
{
"provider_name": "valuedomain",
"domain": domainname,
"valuedomain": {"auth_token": self.auth_token},
})
}
)
return Provider(config)

def test_vdapi_get_domain_list(self):
Expand Down
4 changes: 1 addition & 3 deletions tests/providers/test_hover.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
from unittest import TestCase

import pyotp

from integration_tests import IntegrationTestsV2


_FAKE_DOMAIN_ID = "dom1127777"
_FAKE_HOVERAUTH = "0123456789abcdef0123456789abcdef"
_FAKE_HOVER_SESSION = "0123456789abcdef0123456789abcdef"
Expand All @@ -30,7 +28,7 @@ def _filter_query_parameters(self):
return ["hover_session", "hoverauth"]

def _test_parameters_overrides(self):
return {'auth_totp_secret': _FAKE_TOTP_SECRET}
return {"auth_totp_secret": _FAKE_TOTP_SECRET}

def _replace_auth(self, cookie):
cookie = re.sub(
Expand Down

0 comments on commit f790273

Please sign in to comment.