From c3535046a6fd6d0327a0977531c526acc12067d3 Mon Sep 17 00:00:00 2001 From: Aleksei Tcelishchev Date: Wed, 5 Apr 2023 14:44:50 -0500 Subject: [PATCH 1/4] fix import to use local paths --- apns_python/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apns_python/__init__.py b/apns_python/__init__.py index 998b1d3..62e0b9e 100644 --- a/apns_python/__init__.py +++ b/apns_python/__init__.py @@ -17,5 +17,5 @@ use them with their module prefix like notification.Alert """ -from notification import Alert, APS, Payload, Headers -from client import Client +from .notification import Alert, APS, Payload, Headers +from .client import Client From 4dc04a82e59dc995ec845b8795ef07a5355cffcf Mon Sep 17 00:00:00 2001 From: Aleksei Tcelishchev Date: Sun, 9 Apr 2023 08:21:05 -0500 Subject: [PATCH 2/4] remove uncompleted timeouts parameters --- apns_python/client.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/apns_python/client.py b/apns_python/client.py index ff13071..fe55d2e 100644 --- a/apns_python/client.py +++ b/apns_python/client.py @@ -13,7 +13,7 @@ class Client(object): def __init__( self, push_mode='dev', secure=True, cert_location=None, - cert_password=None, conn_timeout, request_timeout): + cert_password=None): if push_mode == 'dev': self.apns_host = Client.dev_apns_host elif push_mode == 'prd': @@ -29,8 +29,7 @@ def __init__( else: ssl_context_obj = None self.conn = HTTP20Connection( - self.apns_host, secure=secure, ssl_context=ssl_context_obj, - timeout=(conn_timeout, request_timeout)) + self.apns_host, secure=secure, ssl_context=ssl_context_obj) def send(self, device_token, headers, payload): """Send the notification to apns. From 1219bcaedebec9f43935ccdb8823d36ab3a7e685 Mon Sep 17 00:00:00 2001 From: Aleksei Tcelishchev Date: Sun, 9 Apr 2023 15:15:33 -0500 Subject: [PATCH 3/4] fix python v2 legacy function --- apns_python/notification.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apns_python/notification.py b/apns_python/notification.py index 8c9379b..57b42b8 100644 --- a/apns_python/notification.py +++ b/apns_python/notification.py @@ -12,7 +12,7 @@ def __init__(self, custom_fields={}, **apn_args): def update_keys(self, apn_args, msg_obj_keys): """Transform the input keys with '_' to apns format with '-'.""" - for k, v in apn_args.iteritems(): + for k, v in apn_args.items(): formated_k = k.replace('_', '-') if formated_k in msg_obj_keys: del apn_args[k] From 436daaf25f3d9e4b2142e98dd87cf338c7dea350 Mon Sep 17 00:00:00 2001 From: Aleksei Tcelishchev Date: Sun, 9 Apr 2023 16:36:59 -0500 Subject: [PATCH 4/4] update to tweaked version --- apns_python/client.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apns_python/client.py b/apns_python/client.py index fe55d2e..b4f8d9d 100644 --- a/apns_python/client.py +++ b/apns_python/client.py @@ -12,7 +12,7 @@ class Client(object): apns_path = '/3/device/' def __init__( - self, push_mode='dev', secure=True, cert_location=None, + self, push_mode='dev', secure=True, cert_chain_location=None, cert_location=None, cert_password=None): if push_mode == 'dev': self.apns_host = Client.dev_apns_host @@ -23,8 +23,8 @@ def __init__( 'The push_mode param must be "dev" or "prd", not {0}'.format( push_mode)) raise ValueError(err_msg) - if cert_location: - ssl_context_obj = tls.init_context( + if cert_location and cert_chain_location: + ssl_context_obj = tls.init_context(cert_path=cert_chain_location, cert=cert_location, cert_password=cert_password) else: ssl_context_obj = None