Move function to setuptools for reusability
This commit is contained in:
parent
a5661dc037
commit
ea13238049
|
@ -1,4 +1,4 @@
|
||||||
import configparser
|
import ast, configparser
|
||||||
|
|
||||||
conffile = "config.cfg"
|
conffile = "config.cfg"
|
||||||
|
|
||||||
|
@ -11,3 +11,8 @@ def getSetting(section, setting):
|
||||||
config.read(conffile)
|
config.read(conffile)
|
||||||
return config.get(section, setting)
|
return config.get(section, setting)
|
||||||
|
|
||||||
|
def getListSetting(section, setting):
|
||||||
|
config = configparser.RawConfigParser()
|
||||||
|
config.read(conffile)
|
||||||
|
lit = config.get(section, setting)
|
||||||
|
return ast.literal_eval(lit)
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import ast, datetime, setuptools, ssltools, twitools
|
import datetime, setuptools, ssltools, twitools
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
hosts = ast.literal_eval(setuptools.getSetting("SSL", "hosts"))
|
hosts = setuptools.getListSetting("SSL", "hosts")
|
||||||
pbefore = int(setuptools.getSetting("SSL", "pbefore"))
|
pbefore = int(setuptools.getSetting("SSL", "pbefore"))
|
||||||
pafter = int(setuptools.getSetting("SSL", "pafter"))
|
pafter = int(setuptools.getSetting("SSL", "pafter"))
|
||||||
two = twitools.twObject()
|
two = twitools.twObject()
|
||||||
|
|
Loading…
Reference in a new issue