Split setuptools from twitools
This commit is contained in:
parent
659096aace
commit
9a4ce98f2d
11
setuptools.py
Normal file
11
setuptools.py
Normal 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)
|
||||||
|
|
25
twitools.py
25
twitools.py
|
@ -1,37 +1,28 @@
|
||||||
import configparser, tweepy
|
import setuptools, 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)
|
|
||||||
|
|
||||||
def cke():
|
def cke():
|
||||||
try:
|
try:
|
||||||
return getSetting("Twitter", "cke")
|
return getSetting("Twitter", "cke")
|
||||||
except:
|
except:
|
||||||
raise SetupException()
|
raise setuptools.SetupException()
|
||||||
|
|
||||||
def cse():
|
def cse():
|
||||||
try:
|
try:
|
||||||
return getSetting("Twitter", "cse")
|
return setuptools.getSetting("Twitter", "cse")
|
||||||
except:
|
except:
|
||||||
raise SetupException()
|
raise setuptools.SetupException()
|
||||||
|
|
||||||
def ato():
|
def ato():
|
||||||
try:
|
try:
|
||||||
return getSetting("Twitter", "ato")
|
return setuptools.getSetting("Twitter", "ato")
|
||||||
except:
|
except:
|
||||||
raise SetupException()
|
raise setuptools.SetupException()
|
||||||
|
|
||||||
def ase():
|
def ase():
|
||||||
try:
|
try:
|
||||||
return getSetting("Twitter", "ase")
|
return setuptools.getSetting("Twitter", "ase")
|
||||||
except:
|
except:
|
||||||
raise SetupException()
|
raise setuptools.SetupException()
|
||||||
|
|
||||||
def user():
|
def user():
|
||||||
return twObject().whoami()
|
return twObject().whoami()
|
||||||
|
|
Loading…
Reference in a new issue