From e30ab77cf4a34b357883ce26ff006fc5cc88b5b0 Mon Sep 17 00:00:00 2001 From: Ben Finney Date: Mon, 19 Dec 2022 09:25:10 +1100 Subject: [PATCH] Use structural blank lines conformant with PEP 8. PEP 8 specifies: * Surround top-level function and class definitions with two blank lines. * Method definitions inside a class are surrounded by a single blank line. --- auth-mastodon.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/auth-mastodon.py b/auth-mastodon.py index c7b79aa..e7d9cdb 100644 --- a/auth-mastodon.py +++ b/auth-mastodon.py @@ -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)