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) sys.exit(0)
def write_parameter( parameter, file_path ): def write_parameter( parameter, file_path ):
print("Setting up newsfeed parameters...") print("Setting up newsfeed parameters...")
print("\n") print("\n")
feeds_db = input("feeds db name: ") feeds_db = input("feeds db name: ")
feeds_db_user = input("feeds db user: ") feeds_db_user = input("feeds db user: ")
feeds_url = input("enter feeds url: ") feeds_url = input("enter feeds url: ")
with open(file_path, "w") as text_file: with open(file_path, "w") as text_file:
print("feeds_db: {}".format(feeds_db), file=text_file) print("feeds_db: {}".format(feeds_db), file=text_file)
print("feeds_db_user: {}".format(feeds_db_user), file=text_file) print("feeds_db_user: {}".format(feeds_db_user), file=text_file)
print("feeds_url: {}".format(feeds_url), file=text_file) print("feeds_url: {}".format(feeds_url), file=text_file)
def create_table(db, db_user, table, sql): def create_table(db, db_user, table, sql):
conn = None conn = None
try: try:
conn = psycopg2.connect(database = db, user = db_user, password = "", host = "/var/run/postgresql", port = "5432") conn = psycopg2.connect(database = db, user = db_user, password = "", host = "/var/run/postgresql", port = "5432")
cur = conn.cursor() cur = conn.cursor()
print("Creating table.. "+table) print("Creating table.. "+table)
# Create the table in PostgreSQL database # Create the table in PostgreSQL database
cur.execute(sql) cur.execute(sql)
conn.commit() conn.commit()
print("Table "+table+" created!") print("Table "+table+" created!")
print("\n") 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 # main