-
-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More configs for apprise and more #203
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -186,4 +186,4 @@ runbot.bat | |
/google_trends.dat | ||
/google_trends.dir | ||
/google_trends.bak | ||
/config-private.yaml | ||
/config.yaml |
This file was deleted.
This file was deleted.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO this .sample just complicates things needlessly. We should just have the file with defaults. Just isn't a common practice with config (with exception of private files usually). |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# RENAME THIS FILE TO config.yaml ONCE CONFIGURED | ||
apprise: | ||
summary: ON_ERROR | ||
exceptions: True # True or False (Whether to send or not exceptions) | ||
promotions: True # True or False (Whether to send or not incomplete promotions) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To be a bit clearer, it'd be nice to change this to |
||
urls: | ||
- 'discord://{WebhookID}/{WebhookToken}' # Replace with your actual Apprise service URLs | ||
retries: | ||
base_delay_in_seconds: 14.0625 # base_delay_in_seconds * 2^max = 14.0625 * 2^6 = 900 = 15 minutes | ||
max: 8 | ||
strategy: EXPONENTIAL | ||
default_geolocation: US # Replace with your country code https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 | ||
logging: DEBUG # DEBUG or INFO |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,10 +40,11 @@ def main(): | |
earned_points = executeBot(currentAccount, args) | ||
except Exception as e1: | ||
logging.error("", exc_info=True) | ||
Utils.sendNotification( | ||
f"⚠️ Error executing {currentAccount.username}, please check the log", | ||
traceback.format_exc(), | ||
) | ||
if Utils.loadConfig().get("apprise", {}).get("exceptions", True): | ||
Utils.sendNotification( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To simplify things, we could add an optional exception parameter (defaults to None). If an exception is provided in sendNotification, we can check the config to see if sending is enabled. If it is, we send. If it isn't, we just return. |
||
f"⚠️ Error executing {currentAccount.username}, please check the log", | ||
traceback.format_exc(), | ||
) | ||
continue | ||
previous_points = previous_points_data.get(currentAccount.username, 0) | ||
|
||
|
@@ -99,14 +100,23 @@ def setupLogging(): | |
|
||
# so only our code is logged if level=logging.DEBUG or finer | ||
# if not working see https://stackoverflow.com/a/48891485/4164390 | ||
_levels = { | ||
'DEBUG': logging.DEBUG, | ||
'INFO': logging.INFO, | ||
'WARNING': logging.WARNING, | ||
'ERROR': logging.ERROR, | ||
'CRITICAL': logging.CRITICAL | ||
} | ||
log_level_str = Utils.loadConfig().get("logging", "DEBUG").upper() | ||
log_level = _levels.get(log_level_str, logging.DEBUG) | ||
logging.config.dictConfig( | ||
{ | ||
"version": 1, | ||
"disable_existing_loggers": True, | ||
} | ||
) | ||
logging.basicConfig( | ||
level=logging.DEBUG, | ||
level=log_level, | ||
format=_format, | ||
handlers=[ | ||
handlers.TimedRotatingFileHandler( | ||
|
@@ -356,6 +366,7 @@ def save_previous_points_data(data): | |
main() | ||
except Exception as e: | ||
logging.exception("") | ||
Utils.sendNotification( | ||
"⚠️ Error occurred, please check the log", traceback.format_exc() | ||
) | ||
if Utils.loadConfig().get("apprise", {}).get("exceptions", True): | ||
Utils.sendNotification( | ||
"⚠️ Error occurred, please check the log", traceback.format_exc() | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be restored, not having it increases the chances someone accidentally commits secret information and from personal experience makes it harder to develop as a result.
It's a bit jarring for people to move things back from config-private.yaml to config.yaml again as well.