-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path__init__.py
63 lines (52 loc) · 1.66 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# SPDX-FileCopyrightText: 2024 Max Mehl <https://mehl.mx>
#
# SPDX-License-Identifier: GPL-3.0-only
"""Global init file"""
import logging
from importlib.metadata import version
__version__ = version("inwx-dns-recordmaster")
# All record keys
RECORD_KEYS = (
"id",
"name",
"type",
"content",
"ttl",
"prio",
"urlRedirectType",
"urlRedirectTitle",
"urlRedirectDescription",
"urlRedirectFavIcon",
"urlRedirectKeywords",
"urlAppend",
)
DEFAULT_APP_CONFIG = """# App configuration for INWX DNS Recordmaster.
# This is not the place for domain records, these can be anywhere and used with the -c flag
# Login data for the INWX API. Can also be a sub-account
[inwx_account]
# Username and password are both required
username = ""
password = ""
# In case your account is 2FA-protected, you can add the TOTP shared secret here
# The program will automatically create a TOTP token for you.
# Note that this may reduce the account's security drastically. It may be better
# to create a sub-account with restricted access. You may also ask the INWX
# support to limit access to this account to certain IP addresses.
shared_secret = ""
# Whether to use the INWX test instance at https://www.ote.inwx.de. Default: false
test_instance = false
"""
def configure_logger(args) -> logging.Logger:
"""Set logging options"""
log = logging.getLogger()
logging.basicConfig(
encoding="utf-8",
format="[%(asctime)s] %(levelname)s: %(message)s",
datefmt="%Y-%m-%d %H:%M:%S",
)
# Set loglevel based on args
if args.debug:
log.setLevel(logging.DEBUG)
else:
log.setLevel(logging.INFO)
return log