Commit ea132380 authored by Klaus-Uwe Mitterer's avatar Klaus-Uwe Mitterer

Move function to setuptools for reusability

parent a5661dc0
import configparser
import ast, configparser
conffile = "config.cfg"
......@@ -11,3 +11,8 @@ def getSetting(section, setting):
config.read(conffile)
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)
#!/usr/bin/python3
import ast, datetime, setuptools, ssltools, twitools
import datetime, setuptools, ssltools, twitools
if __name__ == "__main__":
hosts = ast.literal_eval(setuptools.getSetting("SSL", "hosts"))
hosts = setuptools.getListSetting("SSL", "hosts")
pbefore = int(setuptools.getSetting("SSL", "pbefore"))
pafter = int(setuptools.getSetting("SSL", "pafter"))
two = twitools.twObject()
......
#!/usr/bin/env python3
import twitools
if __name__ == "__main__":
two = twitools.twObject()
text = input("> ")
two.tweet(text)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment