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

does not work with python 3.10 #675

Closed
samirsd opened this issue Nov 30, 2022 · 14 comments
Closed

does not work with python 3.10 #675

samirsd opened this issue Nov 30, 2022 · 14 comments

Comments

@samirsd
Copy link

samirsd commented Nov 30, 2022

No description provided.

@uzza1hossain
Copy link
Member

Can you provide additional context?

@samirsd
Copy link
Author

samirsd commented Nov 30, 2022

when I try to send a push notification I get cannot import name 'Iterable' from 'collections' (/opt/homebrew/Cellar/[email protected]/3.10.6_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/collections/__init__.py)

@samirsd
Copy link
Author

samirsd commented Nov 30, 2022

others have commented on this issue. it seems to be related to unmaintained dependencies, specifically apns2 and hyper I believe.

#583

#622 (comment)

@bradleydworak
Copy link

Yes, concur, the incompatibility with Python 3.10 is due to the apns2 and thus hyper dependencies. May need to consider incorporating aioapns as an alternative. Thoughts?

@samirsd
Copy link
Author

samirsd commented Jan 25, 2023

yes i’ve been using aiopns as a result of these issues actually and it has been working for me

@bradleydworak
Copy link

bradleydworak commented Jan 26, 2023 via email

@bradleydworak
Copy link

@samirsd Did you encounter an issue with aioapns complaining that it is expecting an EllipticCurve PrivateKey/PublicKey pair? If so, could you tell me what you did to resolve the issue, or point me to a online reference? I have the APNS cert/key pem file already.

@samirsd
Copy link
Author

samirsd commented Feb 5, 2023

@bradleydworak I didn't encounter that issue but I've been using it in sandbox mode

Maybe double check the steps for generating your .p8 file?

my code looks like this:

`
async def send_message(device_token, message):
key_path = os.path.join(settings.BASE_DIR, "path/to/my/AuthKey_12345ABC.p8")
use_sandbox = True

apns_key_client = APNs(
    key= key_path,
    key_id=KEY_ID,
    team_id=TEAM_ID,
    topic=IOS_APP_BUNDLE_ID,  # Bundle ID
    use_sandbox=use_sandbox,
)
request = NotificationRequest(
    device_token=device_token,
    message = {
        "aps": {
            "alert": message,
            "badge": "1",
        }
    },
    notification_id=str(uuid4()),  # optional
    time_to_live=3,                # optional
    push_type=PushType.ALERT,      # optional             # optional
)
await apns_key_client.send_notification(request)

`

I did however encounter an issue where aioapns would send repeated push notifications so I just commented out the retry logic as follows: samirsd/aioapns@f7e6081

@bradleydworak
Copy link

bradleydworak commented Feb 5, 2023 via email

@samirsd
Copy link
Author

samirsd commented Feb 5, 2023

It has to be done from the apple developer website https://stackoverflow.com/questions/44631803/ios-swift-how-to-create-p8-file

`Certificates, Identifiers & Profiles > Keys > Click "+" > Check Apple Push Notifications service (APNs)

Choose a name, then register it. It will give you an option to download the p8 file.`

@bradleydworak
Copy link

bradleydworak commented Feb 6, 2023 via email

@samirsd
Copy link
Author

samirsd commented Feb 6, 2023

no prob glad i could help

@AsimDawrat
Copy link

Any fork you know which uses aioapns?

@azmeuk
Copy link
Member

azmeuk commented Aug 18, 2023

Closing in favor of #622

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

5 participants