Fixed indents

This commit is contained in:
spla 2020-10-24 10:48:23 +02:00
pare 9726ed0a64
commit 4f81012645

Veure arxiu

@ -29,42 +29,42 @@ def get_parameter( parameter, file_path ):
sys.exit(0)
def write_parameter( parameter, file_path ):
print("Setting up newsfeed parameters...")
print("\n")
feeds_db = input("feeds db name: ")
feeds_db_user = input("feeds db user: ")
feeds_url = input("enter feeds url: ")
print("Setting up newsfeed parameters...")
print("\n")
feeds_db = input("feeds db name: ")
feeds_db_user = input("feeds db user: ")
feeds_url = input("enter feeds url: ")
with open(file_path, "w") as text_file:
print("feeds_db: {}".format(feeds_db), file=text_file)
print("feeds_db_user: {}".format(feeds_db_user), file=text_file)
print("feeds_url: {}".format(feeds_url), file=text_file)
with open(file_path, "w") as text_file:
print("feeds_db: {}".format(feeds_db), file=text_file)
print("feeds_db_user: {}".format(feeds_db_user), file=text_file)
print("feeds_url: {}".format(feeds_url), file=text_file)
def create_table(db, db_user, table, sql):
conn = None
try:
conn = None
try:
conn = psycopg2.connect(database = db, user = db_user, password = "", host = "/var/run/postgresql", port = "5432")
cur = conn.cursor()
conn = psycopg2.connect(database = db, user = db_user, password = "", host = "/var/run/postgresql", port = "5432")
cur = conn.cursor()
print("Creating table.. "+table)
# Create the table in PostgreSQL database
cur.execute(sql)
print("Creating table.. "+table)
# Create the table in PostgreSQL database
cur.execute(sql)
conn.commit()
print("Table "+table+" created!")
print("\n")
conn.commit()
print("Table "+table+" created!")
print("\n")
except (Exception, psycopg2.DatabaseError) as error:
except (Exception, psycopg2.DatabaseError) as error:
print(error)
print(error)
finally:
finally:
if conn is not None:
if conn is not None:
conn.close()
conn.close()
###############################################################################
# main