Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Config:
- def __init__(self,system):
- self.config = configparser.ConfigParser()
- self.config.read("config.ini")
- self.connection_source=self.config.get(system,'Source')
- self.system=system
- def getsystemSources(self):
- return self.connection_source
- def getConnection(self,source):
- self.source=source
- self.connection_string=self.config.get('CONNECTION',self.system+'_'+source+'_'+'connectstring') ## Connection
- self.connection_user=self.config.get('CONNECTION',self.system+'_'+source+'_'+'user') ## Connection user
- self.connection_password=self.config.get('CONNECTION',self.system+'_'+source+'_'+'password') ## Connection pass
- class Connection(IngesConfig):
- def __init__ (self):
- self.connection_string=Config.connection_string
- self.connection_user=Config.connection_user
- self.connection_password=Config.connection_user
- self.connection_source=Config.connection_source
- def conn_function(self):
- print (self.connection_string)
- print (self.connection_user)
- print (self.connection_password)
- emp1 = Config('Windows')
- value=emp1.getsystemSources()
- print (value)
- emp2 = Connection() -> how to run it ?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement