From 744693d024efcf1a078d638cd3724b6b48f6deed Mon Sep 17 00:00:00 2001 From: Niccari Date: Wed, 19 Jun 2024 17:54:30 +0900 Subject: [PATCH 1/4] raise AuthenticationError when status_code == 401 --- pyfcm/baseapi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfcm/baseapi.py b/pyfcm/baseapi.py index 19bd804..e5014e0 100644 --- a/pyfcm/baseapi.py +++ b/pyfcm/baseapi.py @@ -192,7 +192,7 @@ def parse_response(self, response): return response.json() elif response.status_code == 401: - raise ("There was an error authenticating the sender account") + raise AuthenticationError("There was an error authenticating the sender account") elif response.status_code == 400: raise InvalidDataError(response.text) elif response.status_code == 404: From 7369b6b2866842fa198ecdc55c1ad6650a1b8fe4 Mon Sep 17 00:00:00 2001 From: "Emmanuel O. Adegbite" Date: Wed, 19 Jun 2024 11:06:40 +0100 Subject: [PATCH 2/4] Update baseapi.py --- pyfcm/baseapi.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyfcm/baseapi.py b/pyfcm/baseapi.py index e5014e0..7fb334f 100644 --- a/pyfcm/baseapi.py +++ b/pyfcm/baseapi.py @@ -192,7 +192,9 @@ def parse_response(self, response): return response.json() elif response.status_code == 401: - raise AuthenticationError("There was an error authenticating the sender account") + raise AuthenticationError( + "There was an error authenticating the sender account" + ) elif response.status_code == 400: raise InvalidDataError(response.text) elif response.status_code == 404: From 3622d2a2c597dc619c60a581d500901f6de706a7 Mon Sep 17 00:00:00 2001 From: r3pr3ss10n <145872387+r3pr3ss10n@users.noreply.github.com> Date: Thu, 20 Jun 2024 13:27:23 +0300 Subject: [PATCH 3/4] Make FCM token optional We don't have to request it if using topics. --- pyfcm/fcm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyfcm/fcm.py b/pyfcm/fcm.py index e340f40..ca3f945 100644 --- a/pyfcm/fcm.py +++ b/pyfcm/fcm.py @@ -5,7 +5,7 @@ class FCMNotification(BaseAPI): def notify( self, - fcm_token, + fcm_token=None, notification_title=None, notification_body=None, notification_image=None, @@ -23,7 +23,7 @@ def notify( Send push notification to a single device Args: - fcm_token (str): FCM device registration ID + fcm_token (str, optional): FCM device registration ID notification_title (str, optional): Message title to display in the notification tray notification_body (str, optional): Message string to display in the notification tray notification_image (str, optional): Icon that appears next to the notification From 6e7e8d158fdcc82e821f8a7582fa754d86f1572c Mon Sep 17 00:00:00 2001 From: "Emmanuel O. Adegbite" Date: Thu, 20 Jun 2024 13:20:28 +0100 Subject: [PATCH 4/4] Update __meta__.py --- pyfcm/__meta__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfcm/__meta__.py b/pyfcm/__meta__.py index 4465f4c..932e00d 100644 --- a/pyfcm/__meta__.py +++ b/pyfcm/__meta__.py @@ -2,7 +2,7 @@ __summary__ = "Python client for FCM - Firebase Cloud Messaging (Android, iOS and Web)" __url__ = "https://github.com/olucurious/pyfcm" -__version__ = "2.0.2" +__version__ = "2.0.3" __author__ = "Emmanuel Adegbite" __email__ = "olucurious@gmail.com"