From e9334a89fd0c52f5aef5063a68ddf6f8ecef5e77 Mon Sep 17 00:00:00 2001 From: Roald Nefs Date: Wed, 24 Oct 2018 22:06:12 +0200 Subject: [PATCH 1/3] Add Python classifiers to setup.py Add Python classifiers to setup.py to include Python, Python 2 and Python 3. For more information about classifiers see: https://www.python.org/dev/peps/pep-0301/#distutils-trove-classification --- setup.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/setup.py b/setup.py index 965ab5c..3050c06 100644 --- a/setup.py +++ b/setup.py @@ -12,4 +12,9 @@ keywords = ['messagebird', 'sms'], install_requires = ['requests>=2.4.1'], license = 'BSD-2-Clause', + classifiers = [ + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 3', + ], ) From fec974d5eceed68fdfc2b30e4c4a0f78dfbb8808 Mon Sep 17 00:00:00 2001 From: Roald Nefs Date: Wed, 24 Oct 2018 22:15:29 +0200 Subject: [PATCH 2/3] Update dict.items() for Python 3 compatibility In Python 3 `items()` return iterators, and a list is never fully build. The `items()` method in Python 3 works like `viewitems()` in Python 2.7. For more information see: https://docs.python.org/3/whatsnew/3.0.html#views-and-iterators-instead-of-lists --- messagebird/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/messagebird/base.py b/messagebird/base.py index 24a5e69..32a1906 100644 --- a/messagebird/base.py +++ b/messagebird/base.py @@ -2,7 +2,7 @@ class Base(object): def load(self, data): - for name, value in data.items(): + for name, value in list(data.items()): if hasattr(self, name): setattr(self, name, value) From abac6037349c7b724f09bfe63fc2b7639a010326 Mon Sep 17 00:00:00 2001 From: Roald Nefs Date: Wed, 24 Oct 2018 22:25:36 +0200 Subject: [PATCH 3/3] Update print to function in example Update print to function in `examples/message_create.py`. The `print` statement becomes the `print()` function in Python 3. --- examples/message_create.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/message_create.py b/examples/message_create.py index 5577bc5..e17494e 100644 --- a/examples/message_create.py +++ b/examples/message_create.py @@ -31,7 +31,7 @@ print(' scheduledDatetime : %s' % msg.scheduledDatetime) print(' createdDatetime : %s' % msg.createdDatetime) print(' recipients : %s\n' % msg.recipients) - print + print() except messagebird.client.ErrorException as e: print('\nAn error occured while requesting a Message object:\n')