Fixed indents
This commit is contained in:
pare
70b8575fe5
commit
c65a4c1fc8
S'han modificat 2 arxius amb 116 adicions i 112 eliminacions
15
db-setup.py
15
db-setup.py
|
@ -66,7 +66,10 @@ def create_table(db, db_user, table, sql):
|
||||||
|
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
#############################################################################################
|
###############################################################################
|
||||||
|
# main
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
|
||||||
# Load configuration from config file
|
# Load configuration from config file
|
||||||
config_filepath = "db_config.txt"
|
config_filepath = "db_config.txt"
|
||||||
|
@ -82,9 +85,7 @@ conn = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
||||||
conn = psycopg2.connect(dbname='postgres',
|
conn = psycopg2.connect(dbname='postgres', user=feeds_db_user, host='', password='')
|
||||||
user=feeds_db_user, host='',
|
|
||||||
password='')
|
|
||||||
|
|
||||||
conn.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT)
|
conn.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT)
|
||||||
|
|
||||||
|
@ -92,9 +93,8 @@ try:
|
||||||
|
|
||||||
print("Creating database " + feeds_db + ". Please wait...")
|
print("Creating database " + feeds_db + ". Please wait...")
|
||||||
|
|
||||||
cur.execute(sql.SQL("CREATE DATABASE {}").format(
|
cur.execute(sql.SQL("CREATE DATABASE {}").format(sql.Identifier(feeds_db)))
|
||||||
sql.Identifier(feeds_db))
|
|
||||||
)
|
|
||||||
print("Database " + feeds_db + " created!")
|
print("Database " + feeds_db + " created!")
|
||||||
|
|
||||||
except (Exception, psycopg2.DatabaseError) as error:
|
except (Exception, psycopg2.DatabaseError) as error:
|
||||||
|
@ -117,6 +117,7 @@ try:
|
||||||
except (Exception, psycopg2.DatabaseError) as error:
|
except (Exception, psycopg2.DatabaseError) as error:
|
||||||
|
|
||||||
print(error)
|
print(error)
|
||||||
|
|
||||||
# Load configuration from config file
|
# Load configuration from config file
|
||||||
os.remove("db_config.txt")
|
os.remove("db_config.txt")
|
||||||
print("Exiting. Run setup again with right parameters")
|
print("Exiting. Run setup again with right parameters")
|
||||||
|
|
|
@ -52,7 +52,10 @@ mastodon = Mastodon(
|
||||||
# Initialise access headers
|
# Initialise access headers
|
||||||
headers={ 'Authorization': 'Bearer %s'%uc_access_token }
|
headers={ 'Authorization': 'Bearer %s'%uc_access_token }
|
||||||
|
|
||||||
########################################################
|
###############################################################################
|
||||||
|
# main
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
|
||||||
publish = 0
|
publish = 0
|
||||||
|
|
||||||
|
|
Loading…
Referencia en una nova incidència