You've already forked Mailu
mirror of
https://github.com/Mailu/Mailu.git
synced 2025-09-16 09:06:32 +02:00
Some flake8 issues with the fetchmail script
This commit is contained in:
@@ -23,6 +23,7 @@ poll "{host}" proto {protocol} port {port}
|
||||
sslproto 'AUTO'
|
||||
"""
|
||||
|
||||
|
||||
def escape_rc_string(arg):
|
||||
return arg.replace("\\", "\\\\").replace('"', '\\"')
|
||||
|
||||
@@ -57,21 +58,21 @@ def run(connection, cursor, keep, debug):
|
||||
options=options
|
||||
)
|
||||
if debug:
|
||||
print( fetchmailrc )
|
||||
print(fetchmailrc)
|
||||
try:
|
||||
print( fetchmail( fetchmailrc ) )
|
||||
print(fetchmail(fetchmailrc))
|
||||
error_message = ""
|
||||
except subprocess.CalledProcessError as error:
|
||||
error_message = error.output.decode( "utf8" )
|
||||
error_message = error.output.decode("utf8")
|
||||
# No mail is not an error
|
||||
if not error_message.startswith("fetchmail: No mail"):
|
||||
print( error_message )
|
||||
|
||||
user_info = "for %s at %s" % ( user_email, host )
|
||||
print(error_message)
|
||||
user_info = "for %s at %s" % (user_email, host)
|
||||
# Number of messages seen is not a error as well
|
||||
if "messages" in error_message and "(seen " in error_message and \
|
||||
user_info in error_message:
|
||||
print( error_message )
|
||||
if ("messages" in error_message and
|
||||
"(seen " in error_message and
|
||||
user_info in error_message):
|
||||
print(error_message)
|
||||
finally:
|
||||
cursor.execute("""
|
||||
UPDATE fetch SET error=?, last_check=datetime('now')
|
||||
@@ -80,7 +81,6 @@ def run(connection, cursor, keep, debug):
|
||||
connection.commit()
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
debug = os.environ.get("DEBUG", None) == "True"
|
||||
keep = os.environ.get("FETCHMAIL_KEEP", None) == "True"
|
||||
@@ -91,4 +91,3 @@ if __name__ == "__main__":
|
||||
run(connection, cursor, keep, debug)
|
||||
cursor.close()
|
||||
time.sleep(int(os.environ.get("FETCHMAIL_DELAY", 60)))
|
||||
|
||||
|
Reference in New Issue
Block a user