Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import psycopg2
- class bancoPostgre:
- def __init__ (self):
- self.__errCon = None
- def getConexao(self,usuario):
- try:
- if usuario in 'postgres':
- host = 'localhost'
- database = 'TesteDevmedia'
- username = 'postgres'
- password = 'postgres'
- else:
- print('funcao_nao_encontrada')
- con = psycopg2.connect(host=host, database=database,user=username, password=password)
- except ValueError as e:
- self.__errCon = str(e)
- return(con)
- def getError(self):
- return self.__errCon
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement