Skip to content

Conversation

@m33rc47
Copy link
Contributor

@m33rc47 m33rc47 commented Mar 1, 2023

No description provided.

@Der-Henning
Copy link
Owner

Hi @dalins.
Thank you for your contribution! I am sorry I didn't answer earlier, but I am very busy at the moment. I will review your code as soon as possible.
Only one first note. Please create your PR on the dev branch. It always contains the latest code.

@m33rc47 m33rc47 changed the base branch from main to dev March 3, 2023 18:17
Copy link
Owner

@Der-Henning Der-Henning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution. I don't have any urgent change requests, but some points to discuss.

log.debug("Sending ntfy Notification")

url = f"{self.server}/{self.topic}"
log.debug("ntfy url: %s", url)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the url does not change on every consecutive call, logging it doesn't add any meaningful information. Consider logging the body as it contains variables.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I think it would be nice to see the final url and therefore I move it into the __init__ method. Are you fine with this solution?

log = logging.getLogger('tgtg')


class Ntfy(Notifier):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The notifier could also be based on the Webhook notifier like the IFTTT notifier. It would only be necessary to add the auth property to the Webhook notifier, which would in general be a good addition.
This would centralize the request logic and make maintaining the code easier.
Using self.__class__.__name__ can be used in the Webhook logs to display the calling Notifier.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, but I think adding authentication to the WebHook should be an other pull request, because it is not part of this feature and affects WebHook and IFTTT functionality. But I like the idea to centralize the request logic and will do that. So are you fine with this argumentation?

@Der-Henning Der-Henning merged commit 2ee65f7 into Der-Henning:dev Mar 7, 2023
@Der-Henning
Copy link
Owner

The latest edge docker images and this pre-Release now contain the ntfy notifier. I will create a new Release after some testing.
Any feedback is appreciated :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants