Split setuptools from twitools

This commit is contained in:
Klaus-Uwe Mitterer 2016-03-16 13:49:28 +01:00
parent 659096aace
commit 9a4ce98f2d
2 changed files with 19 additions and 17 deletions

11
setuptools.py Normal file
View file

@ -0,0 +1,11 @@
import configparser
class SetupException(Exception):
def __str__(self):
return "Seems like config.cfg has not been created yet. Run setup.py to do so."
def getSetting(section, setting):
config = configparser.RawConfigParser()
config.read('config.cfg')
return config.get(section, setting)

View file

@ -1,37 +1,28 @@
import configparser, tweepy
class SetupException(Exception):
def __str__(self):
return "Seems like config.cfg has not been created yet. Run setup.py to do so."
def getSetting(section, setting):
config = configparser.RawConfigParser()
config.read('config.cfg')
return config.get(section, setting)
import setuptools, tweepy
def cke():
try:
return getSetting("Twitter", "cke")
except:
raise SetupException()
raise setuptools.SetupException()
def cse():
try:
return getSetting("Twitter", "cse")
return setuptools.getSetting("Twitter", "cse")
except:
raise SetupException()
raise setuptools.SetupException()
def ato():
try:
return getSetting("Twitter", "ato")
return setuptools.getSetting("Twitter", "ato")
except:
raise SetupException()
raise setuptools.SetupException()
def ase():
try:
return getSetting("Twitter", "ase")
return setuptools.getSetting("Twitter", "ase")
except:
raise SetupException()
raise setuptools.SetupException()
def user():
return twObject().whoami()