Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It gives error when used .p8 file instead pem file. What should I have to do??? #38

Open
sneha2310 opened this issue Jan 6, 2023 · 2 comments

Comments

@sneha2310
Copy link

No description provided.

@colingoodman
Copy link

I utilize a .p8 file without issue. What's the error you're receiving?

@AsimDawrat
Copy link

def send_message(self, message, creds=None, **kwargs): # from .apns import apns_send_message from aioapns import APNs, NotificationRequest, PushType from uuid import uuid4 from .conf import get_manager import asyncio from asgiref.sync import async_to_sync, sync_to_async extra = kwargs['extra'] apns_key_client = APNs( key=creds, key_id=extra['key_id'], team_id=extra['team_id'], topic=extra['bundle_id'], # Bundle ID use_sandbox=extra['sandbox'], ) print("Cert \n", apns_key_client) request = NotificationRequest( device_token=self.registration_id, message = { "aps": { "alert": message, "badge": "", } }, notification_id=str(uuid4()), # optional time_to_live=3, # optional push_type=PushType.ALERT, # optional ) _async = async_to_sync(apns_key_client.send_notification) return _async(request)

Error:
Could not connect to server: Task <Task pending name='Task-72' coro=<AsyncToSync.main_wrap() running at /usr/local/lib/python3.10/site-packages/asgiref/sync.py:306> cb=[_run_until_complete_cb() at /usr/local/lib/python3.10/asyncio/base_events.py:184]> got Future <Future pending cb=[_chain_future.._call_check_cancel() at /usr/local/lib/python3.10/asyncio/futures.py:385]> attached to a different loop
Could not send notification 23273f0d-97db-4ee1-b8d2-a4b5dbde3ecc: ConnectionError
Could not connect to server: Task <Task pending name='Task-72' coro=<AsyncToSync.main_wrap() running at /usr/local/lib/python3.10/site-packages/asgiref/sync.py:306

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants