Files
2025-05-20 09:16:54 -04:00

54 lines
1.9 KiB
Python

"""
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
import configparser
from base64 import b64decode
from encodings import utf_8
from datetime import datetime
class reader:
def __init__(self):
self.CONFIG = configparser.RawConfigParser(allow_no_value=True)
self.options = []
self.parameters = {}
def retrieve(self, filename):
self.CONFIG.read(filename)
self.parameters["check_suspended"] = self.CONFIG.get(
"query_template", "check_suspended"
)
self.parameters["sender"] = self.CONFIG.get("global", "sender")
self.parameters["receivers"] = self.CONFIG.get("global", "receivers")
self.parameters["mailhost"] = self.CONFIG.get("global", "mailhost")
self.sf_logins = {}
for option, value in self.CONFIG.items("sf_targets"):
loginname = option
itemlist = value.split(",")
pw = bytes(itemlist[2], "UTF8")
npw = b64decode(pw).decode("UTF8")
self.sf_logins[loginname] = (
loginname,
[itemlist[0], itemlist[1], npw, itemlist[3], itemlist[4], itemlist[5]],
itemlist[6],
)
self.parameters["logins"] = self.sf_logins
now = datetime.now()
currenttime = now.strftime("%m%d%Y_%H%M%S")
self.parameters["currenttime"] = currenttime
return self.parameters
def __del__(self):
pass