Corect code style for main Python module. #2

Merged
mike merged 17 commits from bignose/ejabberd-auth-mastodon:wip/maintenance/code-style into master 2023-01-01 21:50:41 +11:00
Showing only changes of commit e30ab77cf4 - Show all commits

View file

@ -1,6 +1,8 @@
#!/usr/bin/env python3
import os, sys, logging, struct, psycopg2, bcrypt, random, atexit, time
# Database connection details. The credentials here need access to the Mastodon database, which "ejabberd" is unlikely
# to have on your system by default. You shoud grant SELECT privileges to ejabberd on the "accounts" and "users" tables,
# to play it safe, or include the Mastodon DB user credentials here (don't).
@ -38,16 +40,21 @@ except:
time.sleep(10)
sys.exit(1)
@atexit.register
def close_db():
cursor.close()
database.close()
logging.info('auth-mastodon script started, waiting for ejabberd requests')
class EjabberdInputError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)