You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
wowstash/wowstash/library/db.py

23 lines
590 B

from psycopg2 import Error as PGError
from psycopg2 import connect as PGConnect
from wowstash import config
class Database(object):
def __init__(self):
self.conn = PGConnect(
user=config.DB_USER,
password=config.DB_PASS,
host=config.DB_HOST,
port=config.DB_PORT,
database=config.DB_NAME
)
cursor = self.conn.cursor()
cursor.execute("SELECT VERSION()")
results = cursor.fetchone()
if results:
self.connected = True
else:
self.connected = False