From f464c9d39fdc13c495ebb7d47225329d6885c0de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Lombra=C3=B1a=20Gonz=C3=A1lez?= Date: Tue, 12 Sep 2017 16:16:45 +0200 Subject: [PATCH 1/4] 2to3 migration. --- .travis.yml | 2 ++ pbsonesignal/__init__.py | 12 ++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index b01e68f..05b05e9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,8 @@ sudo: false language: python python: - "2.7" + - "3.5" + - "3.6" install: - pip install -r requirements.txt - pip install -r requirements-testing.txt diff --git a/pbsonesignal/__init__.py b/pbsonesignal/__init__.py index 08326c7..946b9d4 100644 --- a/pbsonesignal/__init__.py +++ b/pbsonesignal/__init__.py @@ -23,7 +23,7 @@ """ import requests -from exceptions import * +from .exceptions import * class PybossaOneSignal(object): @@ -51,7 +51,7 @@ def __init__(self, api_key=None, app_id=None, app_ids=None, auth_key=None): else: self.app_ids = app_ids except Exception as e: - print "ERROR: %s: %s" % (type(e), e) + print("ERROR: %s: %s" % (type(e), e)) raise e def header(self, auth): @@ -130,12 +130,12 @@ def push_msg(self, contents={"en": "English Message"}, response = req.json() - if 'errors' in response.keys(): + if 'errors' in list(response.keys()): for error in response['errors']: raise CreateNotification(error) return (req.status_code, req.reason, req.json()) except CreateNotification as e: - print "ERROR: %s: %s" % (type(e), e) + print("ERROR: %s: %s" % (type(e), e)) raise e def create_app(self, name, @@ -163,11 +163,11 @@ def create_app(self, name, response = req.json() - if 'errors' in response.keys(): + if 'errors' in list(response.keys()): for error in response['errors']: raise CreateApp(error) return (req.status_code, req.reason, req.json()) except CreateApp as e: - print "ERROR: %s: %s" % (type(e), e) + print("ERROR: %s: %s" % (type(e), e)) raise e From a44049d3ddf4063429f8d010d905116fe18266e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Lombra=C3=B1a=20Gonz=C3=A1lez?= Date: Tue, 12 Sep 2017 16:19:18 +0200 Subject: [PATCH 2/4] Readme badges. --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 938212a..0950690 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # PYBOSSA OneSignal library [![Build Status](https://travis-ci.org/Scifabric/pybossa-onesignal.svg?branch=master)](https://travis-ci.org/Scifabric/pybossa-onesignal) [![Coverage Status](https://coveralls.io/repos/github/Scifabric/pybossa-onesignal/badge.svg?branch=master)](https://coveralls.io/github/Scifabric/pybossa-onesignal?branch=master) [![Code Health](https://landscape.io/github/Scifabric/pybossa-onesignal/master/landscape.svg?style=flat)](https://landscape.io/github/Scifabric/pybossa-onesignal/master) +[![Python 2.7](https://img.shields.io/badge/python-2.7-green.svg)](https://pypi.python.org/pypi/pybossa-onesignal/) +[![Python 3.5](https://img.shields.io/badge/python-3.5-blue.svg)](https://pypi.python.org/pypi/pybossa-onesignal/) +[![Python 3.6](https://img.shields.io/badge/python-3.6-orange.svg)](https://pypi.python.org/pypi/pybossa-onesignal/) ## Intro From 8ad93acbf74676e0a7539e2d6191aac436b7759e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Lombra=C3=B1a=20Gonz=C3=A1lez?= Date: Tue, 12 Sep 2017 16:19:35 +0200 Subject: [PATCH 3/4] Ignore. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index c07f071..77f3097 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ env/ dist/ pybossa_onesignal.egg-info/ +env3/ From 45a8facb11b8f038b40309572f1eb50b976e7374 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Lombra=C3=B1a=20Gonz=C3=A1lez?= Date: Tue, 12 Sep 2017 16:19:55 +0200 Subject: [PATCH 4/4] Increase version number. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 4cb3306..3cb0d2e 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name='pybossa-onesignal', - version='1.0', + version='1.1', packages=find_packages(), install_requires=['requests>=0.13.0'], # metadata for upload to PyPI