Giter Club home page Giter Club logo

notifiers's Introduction

Hi there ๐Ÿ‘‹

My name is Or Carmi and I'm a software developer living in Israel. My main passion is python development and I spent the majority of my proffesional career as a QA automation software engineer.

I'm the creator of the notifiers library, a python library that enables sending notification for a large collection of providers.

I am a maintainer of Flexget, a python application designed for customizable download automation.

I have vast proffesional experience with the pytest testing framework.

For my proffesional history, please visit my linkedin profile.

You can follow me on twitter

notifiers's People

Contributors

alonm-totango avatar conight avatar darora-zipline avatar delirious-lettuce avatar dependabot-preview[bot] avatar dependabot[bot] avatar dpdani avatar exequiel09 avatar gitter-badger avatar grabear avatar jonshedden avatar jordansussman avatar k0in avatar kopytjuk avatar liiight avatar pre-commit-ci[bot] avatar pyup-bot avatar recursing avatar snyk-bot avatar timgates42 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

notifiers's Issues

'from' can't be used as a keyword argument in the email notifier.

Trying to use the optional 'from' argument as a keyword argument to the notify method for the email notifier is a syntax error when used from code (it works just fine from the CLI interface).

Maybe 'from' should be renamed to avoid the problem. A work-around is calling notify with dictionary unpacking. But that should probably be documented.

>>> from notifiers import get_notfier
>>> p = get_notifier('email')
<Provider:[Email]>
>>> p.notify(to='[email protected]', message='Will not work', from='[email protected]')

File "<stdin>", line 1
p.notify(to='[email protected]', message='Will not work', from='[email protected]')
...............................................................^
SyntaxError: invalid syntax

>>> p.notify(**{'to':'[email protected]', 'message':'Will work', 'from':'[email protected]'})
<Response,provider=Email,status=Success>

SyntaxError from notifiers_cli

python3.5
pip3 install notifiers

root@server:~# notifiers
Traceback (most recent call last):
  File "/usr/local/bin/notifiers", line 7, in <module>
    from notifiers_cli.core import entry_point
  File "/usr/local/lib/python3.5/dist-packages/notifiers_cli/core.py", line 72
    click.echo(f"Name: '{name}', Schema: {schema}")
                                                 ^
SyntaxError: invalid syntax

Library layout need a few improvements

I have noticed that there are some improvements that can be done to the repository:

  • documentation should have its own directory (usually docs) where to contain the RST files and the Sphinx configuration files
  • there are duplicate requirements files. I suggest to group them all in a requirements directory.
  • I don't think there is a need to keep the cli separated from the core library.

Cheers,
Vlad.

move all `required` logic into a separate class variable

some required parts of providers' schema can be more complex then a simple key list. In such cases, there's a need to override Provider.required property method and return the relevant part.

This should be refactored as such:

  • Providers will hold the required parts of the schema in an internal __required variable
  • By default, Provider.required will return that
  • The Provider.schema method will merge that part when constructing the schema (This will require moving schema to an internal __schema class variable as well to retain consistency.

This change is potentially breaking for anyone that relies on the output of the required method

Unable to run tests locally (BadArguments error): add a CONTRIBUTING.md file?

Hi again.

I wanted to fork notifiers and run tests on my computer.

$ git clone https://github.com/Delgan/notifiers
$ cd notifiers/
$ git checkout master
$ python3.6 -m virtualenv env
$ source env/bin/activate
$ pip install -e .
$ pip install -r dev-requirements.txt
$ pytest tests
============================= test session starts =============================
platform linux -- Python 3.6.4, pytest-3.4.2, py-1.5.2, pluggy-0.6.0
rootdir: /mnt/c/Users/adrie/Desktop/notifiers, inifile: setup.cfg
plugins: cov-2.5.1
collected 197 items

tests/test_cli.py ..............
tests/test_core.py .............................
tests/test_logger.py .......
tests/providers/test_gitter.py .....FF....FF.FF
tests/providers/test_gmail.py ...F...
tests/providers/test_hipchat.py ............
tests/providers/test_join.py ....s.....s
tests/providers/test_mailgun.py ......FF.
tests/providers/test_pagerduty.py ......FF
tests/providers/test_popcornnotify.py ....F.
tests/providers/test_pushbullet.py ...FFFss
tests/providers/test_pushover.py ....FFFF.F..F..F.F.F
tests/providers/test_simplepush.py ...F
tests/providers/test_slack.py .FF
tests/providers/test_smtp.py ......F
tests/providers/test_statuspage.py ........FFFF..
tests/providers/test_telegram.py .....FFF..F.F
tests/providers/test_twilio.py .F
tests/providers/test_zulip.py ...FF..
                                                                   

============== 42 failed, 151 passed, 4 skipped in 17.40 seconds ===============

Many of the tests are failing with an error like:

notifiers.exceptions.BadArguments: Error with sent data: 'user' is a required property

What am I doing wrong?

Add support for previous Python version still maintained (3.4, 3.5)?

Hi!

According to the Status of Python branches, end-of-life for Python 3.4 and 3.5 are respectively scheduled for March 2019 and September 2020.

What are your thoughts on basing notifiers supported versions on the Python agenda?

I'm asking because I remember at first you were wondering if you should support Python 2.7 or not. Although maintaining both Python2.7 / Python3.+ is certainly a headache that is not worth it, adding support for 3.4 "just" requires to drop the use of f-strings. But it also implies not being able to enjoy these neat features before several years.

The advantage is to extend and facilitate the use, adding for example a "native" compatibility with Ubuntu 16.04 which is delivered with Python 3.5.

I do not have a pronounced opinion on the question, but I would like to know whether or not to consider notifiers as being Python3.6+ only.

Support for Zulip

Zulip, http://zulip.org, is an enterprise chat solution that can be used in a self-hosted fashion (available as free/open-source). One could see it as a better Slack, and I believe notifiers could benefit from adding compatibility with it.

I am using it with Slack at the moment, but some of the automated notifications arrive often and "eat the quota" very fast.

Add schema path to json validation exception messages

Currently if you have a json object like this:

                'personalizations': [
                    {   
                        'to': [
                            {   
                                'email': '[email protected]',
                                'name': 'someone'
                            },  
                            {   
                                'name': 'someone'
                            }   
                        ]   
                    }   
                ]   
            }

in a schema where each 'to' object needs an 'email' variable, the validation error message will read: Error with sent data: 'email' is a required property
This is difficult to track down in large arrays, and can also be confusing when variable names are reused at different levels of nesting.

It would be better if the message read something like: Error with sent data: 'personalizations.to.1.email' is a required property

Notifiers may raise unexpected "KeyError"

Hello.

Looking at this code sample for example, I would expect some NotifierException rather than a KeyError:

Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import notifiers
>>> zulip = notifiers.providers.zulip.Zulip()
>>> zulip.notify(message="msg", email="[email protected]", api_key="abc", subject="test", to="[email protected]", domain="")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\delgan\AppData\Local\Programs\Python\Python36\lib\site-packages\notifiers\core.py", line 272, in notify
    data = self._process_data(**kwargs)
  File "C:\Users\delgan\AppData\Local\Programs\Python\Python36\lib\site-packages\notifiers\core.py", line 204, in _proces
s_data
    data = self._prepare_data(data)
  File "C:\Users\delgan\AppData\Local\Programs\Python\Python36\lib\site-packages\notifiers\providers\zulip.py", line 75,
in _prepare_data
    base_url = self.base_url.format(domain=data.pop('domain')) if data.get('domain') else data.pop('server')
KeyError: 'server'

The issue with using if data.get(key) is that it not only evaluates as False when the key is missing, but also when there is a "falsy" value.

I saw this recipe multiple time in the source code. Maybe if key in data should be used instead?

This is a minor detail (I am not even sure it deserves a fix?), but I'm reporting this in case it causes subtle bugs for providers accepting falsy values like 0.

SMS notification (using Twilio?)

Hey!

I really like your notifiers library. This is exactly what I was looking for a few weeks ago, but I did not find anything. Today, here it is, so thank you for the work!

I thought a very useful notification type would be sending SMS. I think we can do this with Twilio for example. Do you think that would be a good idea?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.