SHARE
TWEET

Untitled

a guest Sep 11th, 2019 128 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import psycopg2
  2.  
  3. class bancoPostgre:
  4.  
  5.     def __init__ (self):
  6.         self.__errCon = None
  7.  
  8.     def getConexao(self,usuario):
  9.         try:
  10.             if usuario in 'postgres':
  11.                 host = 'localhost'
  12.                 database = 'TesteDevmedia'
  13.                 username = 'postgres'
  14.                 password = 'postgres'
  15.             else:
  16.                 print('funcao_nao_encontrada')
  17.  
  18.             con = psycopg2.connect(host=host, database=database,user=username, password=password)  
  19.  
  20.         except ValueError as e:
  21.             self.__errCon = str(e)
  22.          
  23.         return(con)
  24.    
  25.     def getError(self):
  26.         return self.__errCon
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top