Skip to content
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

Added support for web change alerts via pushover #18

Closed
wants to merge 2 commits into from

Conversation

atiro
Copy link

@atiro atiro commented May 23, 2015

Copied from the XMPP patch, support for Pushover API to send notifications about website changes. Pushover config file needs to have App Key & User Key (created with a pushover account)

@@ -59,6 +59,7 @@ urls_txt = os.path.join(urlwatch_dir, 'urls.txt')
cache_dir = os.path.join(urlwatch_dir, 'cache')
scripts_dir = os.path.join(urlwatch_dir, 'lib')
hooks_py = os.path.join(scripts_dir, 'hooks.py')
pushover_txt = os.path.join(urlwatch_dir, 'pushover.conf')
Copy link
Owner

Choose a reason for hiding this comment

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

This variable should probably be called pushover_conf.

@thp
Copy link
Owner

thp commented May 24, 2015

Added some comments, please have a look. You can run the pep8 utility to check for code style issues (the current code that we have might not fully comply with PEP8 yet, but if new additions are PEP8-compliant, that would be good).

@atiro
Copy link
Author

atiro commented Jun 8, 2015

Cheers for feedback Thomas, hopefully all fixed now in latest commit.

@@ -388,10 +427,25 @@ if __name__ == '__main__':
short_summary += '\n\n\n'
if not options.quiet:
print short_summary

if(options.pushover):
Copy link
Owner

Choose a reason for hiding this comment

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

PEP-8:

if options.pushover:

@thp
Copy link
Owner

thp commented Jun 11, 2015

Two more code style issues, apart from that I think this can go in. Can you also add a short usage example to the README file, so users can test this?

@atiro
Copy link
Author

atiro commented Jun 14, 2015

Quick example added

config = ConfigParser.RawConfigParser()
config.read(pushover_conf)
except ConfigParser:
log.error('Failed to parse pushover config file %s' % options.pushover_file)
Copy link
Owner

Choose a reason for hiding this comment

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

The logger takes care of formatting the string, so replace % with ,:

log.error('Failed to parse pushover config file %s', options.pushover_file)

@thp
Copy link
Owner

thp commented Jun 16, 2015

Also, please squash your changes after you've integrated the fixes, then I think it should be good to go in.

@atiro
Copy link
Author

atiro commented Jul 16, 2015

Sorry for delay, hopefully all ready now.

if options.pushover:
summary_txt = '%(type)s: <a href="%(url)s">%(url)s</a>' % {'type': type.upper(), 'url': str(url)}
else:
summary_txt = ': '.join((type.upper(), str(url)))
Copy link
Owner

Choose a reason for hiding this comment

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

Indentation issue (should be 4 spaces).

@thp
Copy link
Owner

thp commented Jul 17, 2015

Spotted two indentation issues, other than that looks good. Can you fixup those?

@thp
Copy link
Owner

thp commented Dec 3, 2015

@atiro: Can you look into the remaining issues so we can merge this?

@thp thp closed this Jan 8, 2016
@atiro
Copy link
Author

atiro commented Jan 18, 2016

Apologies, totally missed this. Added now very late!

@thp
Copy link
Owner

thp commented Jan 18, 2016

You should now be able to write a Reporter subclass and just add any settings you need to the configuration (storage.py has a DEFAULT_CONFIG and the config is written to / read from the urlwatch.yaml file automatically), have a look at the examples:

https://github.com/thp/urlwatch/blob/master/share/urlwatch/examples/hooks.py.example#L92
https://github.com/thp/urlwatch/blob/master/lib/urlwatch/reporters.py#L309

@thp thp reopened this Jan 18, 2016
@thp
Copy link
Owner

thp commented Jan 18, 2016

Default settings can be placed here, like with the e-mail reporter:

https://github.com/thp/urlwatch/blob/master/lib/urlwatch/storage.py#L67

@atiro
Copy link
Author

atiro commented Jan 24, 2016

Seems easier to submit for the updated code so I'll close this PR and create a new one based on urlwatch2

@atiro atiro closed this Jan 24, 2016
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.

None yet

3 participants