Skip to content

Commit

Permalink
Python 3 Support Added
Browse files Browse the repository at this point in the history
  • Loading branch information
caronc committed Jun 14, 2019
1 parent 318616e commit 93d69c6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
7 changes: 6 additions & 1 deletion Notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
###########################################################################
import logging
import re
import six
from os.path import join
from os.path import dirname
from os.path import isfile
Expand Down Expand Up @@ -199,6 +200,10 @@ def decode(str_data, encoding=None):
If encoding == None then it is attempted to be detected by chardet
If encoding is a string, then only that encoding is used
"""
if six.PY3:
# nothing to do for Python 3
return str_data

if isinstance(str_data, unicode):
return str_data

Expand Down Expand Up @@ -301,7 +306,7 @@ def notify(self, servers, body, title, notify_type=NotifyType.INFO,
# true/false flag
include_image = self.parse_bool(self.get('IncludeImage'), False)

if isinstance(servers, basestring):
if isinstance(servers, six.string_types):
# servers can be a list of URLs, or it can be
# a string which will be parsed into this list
# we wanted.
Expand Down
11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Send notifications to all of the popular notification services (PushBullet, Noti
You can even run the tool from the command line for your own custom use. Notify.py was written in such a way that there wouldn't be a lot of effort to add more notification services either. Feel free to contact me if one you would like to use is missing.

## Installation Instructions
1. Ensure you have Python v2.7 installed onto your system.
1. Ensure you have Python v2.7 or later installed onto your system.
```bash
# Pull in dependencies:
pip install -r requirements.txt
Expand All @@ -28,20 +28,13 @@ pip install -r requirements.txt
The Non-NZBGet/SABnzbd users can also use this script from the command line.
See the __Command Line__ section below for more instructions on how to do this.

**Note:** The _Notify_ directory provides all of the necessary dependencies
in order for this script to work correctly. The directory is only required
if you do not have the packages already available to your global
environment. These dependant packages are all identified under the
_Dependencies_ section below.

## Supported Notifications
The section identifies all of the services supported by this script.

### Popular Notification Services
The table below identifies the provider _Notify.py_ supports and the
location that content is retrieved from.


| Notification Service | Service ID | Default Port | Example Syntax |
| -------------------- | ---------- | ------------ | -------------- |
| [AWS SNS](https://github.com/caronc/apprise/wiki/Notify_sns) | sns:// | (TCP) 443 | sns://AccessKeyID/AccessSecretKey/RegionName/+PhoneNo<br/>sns://AccessKeyID/AccessSecretKey/RegionName/+PhoneNo1/+PhoneNo2/+PhoneNoN<br/>sns://AccessKeyID/AccessSecretKey/RegionName/Topic<br/>sns://AccessKeyID/AccessSecretKey/RegionName/Topic1/Topic2/TopicN
Expand Down Expand Up @@ -85,6 +78,8 @@ Apprise have some email services built right into it (such as yahoo, fastmail, h
| [JSON](https://github.com/caronc/apprise/wiki/Notify_Custom_JSON) | json:// or jsons:// | (TCP) 80 or 443 | json://hostname<br />json://user@hostname<br />json://user:password@hostname:port<br />json://hostname/a/path/to/post/to
| [XML](https://github.com/caronc/apprise/wiki/Notify_Custom_XML) | xml:// or xmls:// | (TCP) 80 or 443 | xml://hostname<br />xml://user@hostname<br />xml://user:password@hostname:port<br />xml://hostname/a/path/to/post/to

**For a complete list of supported notification services, check out what is listed for [Apprise](https://github.com/caronc/apprise/).

## Command Line
Notify.py has a built in command line interface that can be easily tied
to a cron entry or can be easily called from the command line to automate
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
apprise >= 0.7.0
pynzbget
chardet
six

0 comments on commit 93d69c6

Please sign in to comment.