Files
archived-starters/python/with-postgres/server.py
Jake Runzer 7336895dcc init
2020-09-11 19:02:13 +01:00

20 lines
275 B
Python

#!/usr/bin/python3
import psycopg2
import os
try:
conn = psycopg2.connect("")
except:
print("Couldn't connect")
cur = conn.cursor()
try:
cur.execute("SELECT NOW()")
except:
print("Oops database fail")
rows = cur.fetchall()
for row in rows:
print(row)