Closed muhammad-mamdouh closed 2 years ago
that package needed to be adjusted IMHO
@auvipy I figured out now that the problem mainly at the apns2
package and actually its updated there but the maintainer didn't release the master update now.
this is because the package is not updated on pip. Use github master branch to install the lastest package
Was anyone able to get this to work? I get this issue when I used the latest commit
apns2 @ git+https://github.com/Pr0Ger/PyAPNs2.git@910780bb909c85ffd40f8d2cd517b764c4576253 PyJWT==2.3.0 django-push-notifications==3.0.0
[03/Apr/2022 19:00:54] "PUT /api/changeTransactionStatus/fdf8c2fd-c937-475a-960f-9d8b862db492/ HTTP/1.1" 200 13966
Traceback (most recent call last):
File "/Users/madhavsoni/.pyenv/versions/3.7.2/lib/python3.7/wsgiref/handlers.py", line 138, in run
self.finish_response()
File "/Users/madhavsoni/.pyenv/versions/3.7.2/lib/python3.7/wsgiref/handlers.py", line 183, in finish_response
self.close()
File "/Users/madhavsoni/eb-virt/lib/python3.7/site-packages/django/core/servers/basehttp.py", line 114, in close
super().close()
File "/Users/madhavsoni/.pyenv/versions/3.7.2/lib/python3.7/wsgiref/simple_server.py", line 38, in close
SimpleHandler.close(self)
File "/Users/madhavsoni/.pyenv/versions/3.7.2/lib/python3.7/wsgiref/handlers.py", line 321, in close
self.result.close()
File "/Users/madhavsoni/Documents/BazarBackend/bazar_backend/api/views/TransactionViews/TransactionView.py", line 168, in close
self.then_callback()
File "/Users/madhavsoni/Documents/BazarBackend/bazar_backend/api/views/TransactionViews/TransactionView.py", line 232, in send_push_notification
badge=lambda token: APNSDevice.objects.get(
File "/Users/madhavsoni/eb-virt/lib/python3.7/site-packages/push_notifications/models.py", line 136, in send_message
creds=creds, **kwargs
File "/Users/madhavsoni/eb-virt/lib/python3.7/site-packages/push_notifications/apns.py", line 154, in apns_send_bulk_message
creds=creds, **kwargs
File "/Users/madhavsoni/eb-virt/lib/python3.7/site-packages/push_notifications/apns.py", line 103, in _apns_send
**notification_kwargs
File "/Users/madhavsoni/eb-virt/lib/python3.7/site-packages/apns2/client.py", line 203, in send_notification_batch
priority, expiration, collapse_id, push_type)
File "/Users/madhavsoni/eb-virt/lib/python3.7/site-packages/apns2/client.py", line 141, in send_notification_async
auth_header = self.__credentials.get_authorization_header(topic)
File "/Users/madhavsoni/eb-virt/lib/python3.7/site-packages/apns2/credentials.py", line 60, in get_authorization_header
token = self._get_or_create_topic_token()
File "/Users/madhavsoni/eb-virt/lib/python3.7/site-packages/apns2/credentials.py", line 90, in _get_or_create_topic_token
headers=headers)
File "/Users/madhavsoni/eb-virt/lib/python3.7/site-packages/jwt/api_jwt.py", line 63, in encode
return api_jws.encode(json_payload, key, algorithm, headers, json_encoder)
File "/Users/madhavsoni/eb-virt/lib/python3.7/site-packages/jwt/api_jws.py", line 113, in encode
key = alg_obj.prepare_key(key)
File "/Users/madhavsoni/eb-virt/lib/python3.7/site-packages/jwt/algorithms.py", line 416, in prepare_key
key = load_pem_public_key(key)
TypeError: load_pem_public_key() missing 1 required positional argument: 'backend'
[03/Apr/2022 19:00:55] "PUT /api/changeTransactionStatus/fdf8c2fd-c937-475a-960f-9d8b862db492/ HTTP/1.1" 500 59
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 51618)
Traceback (most recent call last):
File "/Users/madhavsoni/.pyenv/versions/3.7.2/lib/python3.7/wsgiref/handlers.py", line 138, in run
self.finish_response()
File "/Users/madhavsoni/.pyenv/versions/3.7.2/lib/python3.7/wsgiref/handlers.py", line 183, in finish_response
self.close()
File "/Users/madhavsoni/eb-virt/lib/python3.7/site-packages/django/core/servers/basehttp.py", line 114, in close
super().close()
File "/Users/madhavsoni/.pyenv/versions/3.7.2/lib/python3.7/wsgiref/simple_server.py", line 38, in close
SimpleHandler.close(self)
File "/Users/madhavsoni/.pyenv/versions/3.7.2/lib/python3.7/wsgiref/handlers.py", line 321, in close
self.result.close()
File "/Users/madhavsoni/Documents/BazarBackend/bazar_backend/api/views/TransactionViews/TransactionView.py", line 168, in close
self.then_callback()
File "/Users/madhavsoni/Documents/BazarBackend/bazar_backend/api/views/TransactionViews/TransactionView.py", line 232, in send_push_notification
badge=lambda token: APNSDevice.objects.get(
File "/Users/madhavsoni/eb-virt/lib/python3.7/site-packages/push_notifications/models.py", line 136, in send_message
creds=creds, **kwargs
File "/Users/madhavsoni/eb-virt/lib/python3.7/site-packages/push_notifications/apns.py", line 154, in apns_send_bulk_message
creds=creds, **kwargs
File "/Users/madhavsoni/eb-virt/lib/python3.7/site-packages/push_notifications/apns.py", line 103, in _apns_send
**notification_kwargs
File "/Users/madhavsoni/eb-virt/lib/python3.7/site-packages/apns2/client.py", line 203, in send_notification_batch
priority, expiration, collapse_id, push_type)
File "/Users/madhavsoni/eb-virt/lib/python3.7/site-packages/apns2/client.py", line 141, in send_notification_async
auth_header = self.__credentials.get_authorization_header(topic)
File "/Users/madhavsoni/eb-virt/lib/python3.7/site-packages/apns2/credentials.py", line 60, in get_authorization_header
token = self._get_or_create_topic_token()
File "/Users/madhavsoni/eb-virt/lib/python3.7/site-packages/apns2/credentials.py", line 90, in _get_or_create_topic_token
headers=headers)
File "/Users/madhavsoni/eb-virt/lib/python3.7/site-packages/jwt/api_jwt.py", line 63, in encode
return api_jws.encode(json_payload, key, algorithm, headers, json_encoder)
File "/Users/madhavsoni/eb-virt/lib/python3.7/site-packages/jwt/api_jws.py", line 113, in encode
key = alg_obj.prepare_key(key)
File "/Users/madhavsoni/eb-virt/lib/python3.7/site-packages/jwt/algorithms.py", line 416, in prepare_key
key = load_pem_public_key(key)
TypeError: load_pem_public_key() missing 1 required positional argument: 'backend'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/madhavsoni/.pyenv/versions/3.7.2/lib/python3.7/wsgiref/handlers.py", line 141, in run
self.handle_error()
File "/Users/madhavsoni/eb-virt/lib/python3.7/site-packages/django/core/servers/basehttp.py", line 119, in handle_error
super().handle_error()
File "/Users/madhavsoni/.pyenv/versions/3.7.2/lib/python3.7/wsgiref/handlers.py", line 368, in handle_error
self.finish_response()
File "/Users/madhavsoni/.pyenv/versions/3.7.2/lib/python3.7/wsgiref/handlers.py", line 180, in finish_response
self.write(data)
File "/Users/madhavsoni/.pyenv/versions/3.7.2/lib/python3.7/wsgiref/handlers.py", line 274, in write
self.send_headers()
File "/Users/madhavsoni/.pyenv/versions/3.7.2/lib/python3.7/wsgiref/handlers.py", line 331, in send_headers
if not self.origin_server or self.client_is_modern():
File "/Users/madhavsoni/.pyenv/versions/3.7.2/lib/python3.7/wsgiref/handlers.py", line 344, in client_is_modern
return self.environ['SERVER_PROTOCOL'].upper() != 'HTTP/0.9'
TypeError: 'NoneType' object is not subscriptable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/madhavsoni/.pyenv/versions/3.7.2/lib/python3.7/socketserver.py", line 650, in process_request_thread
self.finish_request(request, client_address)
File "/Users/madhavsoni/.pyenv/versions/3.7.2/lib/python3.7/socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/Users/madhavsoni/.pyenv/versions/3.7.2/lib/python3.7/socketserver.py", line 720, in __init__
self.handle()
File "/Users/madhavsoni/eb-virt/lib/python3.7/site-packages/django/core/servers/basehttp.py", line 174, in handle
self.handle_one_request()
File "/Users/madhavsoni/eb-virt/lib/python3.7/site-packages/django/core/servers/basehttp.py", line 197, in handle_one_request
handler.run(self.server.get_app())
File "/Users/madhavsoni/.pyenv/versions/3.7.2/lib/python3.7/wsgiref/handlers.py", line 144, in run
self.close()
File "/Users/madhavsoni/eb-virt/lib/python3.7/site-packages/django/core/servers/basehttp.py", line 114, in close
super().close()
File "/Users/madhavsoni/.pyenv/versions/3.7.2/lib/python3.7/wsgiref/simple_server.py", line 35, in close
self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
When installing any package with
PyJWT >= 2.0.0
the server crashes as thedjango-push-notifications
requirePyJWT < 2.0.0
Traceback: