django-push-notifications | Send push notifications to mobile devices | Notification library
kandi X-RAY | django-push-notifications Summary
kandi X-RAY | django-push-notifications Summary
Send push notifications to mobile devices through GCM or APNS in Django.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Validate application configuration
- Validate required settings
- Validate application settings
- Validate the APNS certificate
- Sends a message
- Yield successive n - sized chunks from l
- Get the global configuration manager
- Send a notification request
- Send a new alert message
- Validate the GCM configuration
- Validate FCM configuration
- Validate WNS configuration
- Send a message
- Prepare a value
- Send a message
- Determine if the application has authentication credentials
- Get notification URL
- Get the maximum number of recipients for a given cloud type
- Convert the value to a string
- Convert value to unsigned integer
- Get FCM API key
- Get the APNS certificate
- Create a new instance
- Send a message to the APNS
- Get the APNS certificate
- Sends a message
django-push-notifications Key Features
django-push-notifications Examples and Code Snippets
from instapush.models.base import BaseDevice, GCMDevice, APNSDevice
device_id = preferences.get_unique_id()
reg_id = preferences.get_registration_id()
user = preferences.get_user()
device = GCMDevice.objects.create(registration_id=reg_id, device_id
from instapush.models.mongo import APNSDevice, GCMDevice
device = GCMDevice.objects.get(owner=request.user)
device.send_message({"type": "notify", "message": "You've a new notification"})
device = APNSDevice.objects.get(owner=request.user)
device.
INSTAPUSH_SETTINGS = {
'DEVICE_OWNER_MODEL': 'accounts.models.UserAccount',
'GCM_SETTINGS': {
'API_KEY': 'my gcm api key'
},
'APNS_SETTINGS': {
'APNS_CERTIFICATE': os.path.join(PROJECT_ROOT, 'keys/apns_sandbox.pem')
Community Discussions
Trending Discussions on django-push-notifications
QUESTION
We need to send iOS push notifications using our Django based backend. Currently, we use this library https://github.com/jazzband/django-push-notifications for sending notifications. Recently, received this mail from Apple Developers.
The HTTP/2‑based Apple Push Notification service (APNs) provider API lets you take advantage of great features, such as authentication with a JSON Web Token, improved error messaging, and per‑notification feedback. If you still send push notifications with the legacy binary protocol, make sure to upgrade to the APNs provider API as soon as possible. APNs will no longer support the legacy binary protocol after March 31, 2021.
I saw that this library uses apns2
(https://pypi.org/project/apns2/) for sending push notifications on iOS and that uses HTTP/2 protocol for sending notifications. So, this library can continue to be used for sending iOS notifications right? Can anybody clarify that for me? Also, it would be great if someone could explain the meaning of legacy binary protocol, that would be great.
ANSWER
Answered 2021-Mar-14 at 10:16After posting the question here, I had also raised Github Issue on Django-Push-Notifications Repository.
I have got a reply from maintainers and it looks like we would be able to continue using this library. Posting his reply here,
For what I understand this should not be an issue nor for this package nor for apns2 (which is used to send Apple-Push-Notifications).
Apple is dismantling the legacy binary protocol (which was announced on October 9 2020) in favor of the HTTP one. However since apns2 implements the latter this would not be an issue here since it already uses the preferred protocol.
For the record: here is the specification of the legacy binary protocol for APNS.
https://github.com/jazzband/django-push-notifications/issues/601#issuecomment-793489138
QUESTION
I have searched over the Stackoverflow, but none of them answer to my questions
Build from Xcode APNS works, but App Store version my backend raises BadDeviceToken
.
The Success
are registration_id
made by build from source
ANSWER
Answered 2020-Feb-10 at 22:30As noted in the README for django-push-notification:
QUESTION
I have successfully implement APNS using django-push-notifications
. And I have found that this dependency is growing up and has a Web Push Notifications
as well. I had tried followed up the given code, but unable to see a registation_id
. I got
ANSWER
Answered 2019-May-20 at 13:04This line:
QUESTION
django-push-notifications
was working with both sandbox and production certificates. But since yesterday it is failing with following errors.
SSLError: [Errno 1] _ssl.c:510: error:1409442E:SSL routines:SSL3_READ_BYTES:tlsv1 alert protocol version
No change in our code or our servers. Any ideas, why it has stopped working.
UPDATE
OpenSSL 1.0.1f 6 Jan 2014 Ubuntu: 14.04
I upgraded to OpenSSL 1.1.1a 20 Nov 2018 but same results.
I also checked TLS version supported by my python using following and got "TLS 1.3".
python -c "import requests; print(requests.get('https://www.howsmyssl.com/a/check', verify=False).json()['tls_version'])"
...ANSWER
Answered 2019-Mar-13 at 19:30From a OpenSSL point of view a client SSL Socket connection to a SSL server is failing because none of the SSL/TLS Socket versions supported by the client is enabled (or supported) on the server.
So my guess is that the server has restricted the protocol versions of SSL/TLS it's supports to the point where your openssl client can't handle it any more. At a guess TLS 1.2 and TLS 1.3 only now. Maybe TLS 1.1.
Can you update your client OpenSSL version to a later version to see if it fixes the connection issues?
Also it may help to check (if you can) what protocol versions you are enabling on the client side to make sure all the highest protocol versions are enabled - TLS 1.1, TLS 1.2, TLS1.3 - if you have openssl 1.1.1.
QUESTION
I am using Django with Zappa to connect to serverless AWS Lambda. To get APNs (Apple Push Notification services) up and running, I originally had to upload my certificate file to the server, so that my backend can access it whenever it needs to. But now that I migrated to AWS Lambda, I am not sure how to upload the certificate file.
I use this package django-push-notifications to use APNs and in my Django settings, I have
PUSH_NOTIFICATIONS_SETTINGS = {
"APNS_CERTIFICATE": os.path.join(BASE_DIR, "../../Certificates_and_keys/prod_pushcert.pem"),
"APNS_TOPIC": "org.reactjs.native.example.Spap",
"UPDATE_ON_DUPLICATE_REG_ID": True,
"USER_MODEL": "social.User",
}
Where the value for APNS_CERTIFICATE is the path of the APNs certificate file. Before using AWS Lambda, I had another server where I uploaded the certificate file with ftp. I don't know how to do that with AWS Lambda. Any suggestions?
...ANSWER
Answered 2019-Mar-06 at 20:11I don't know off the top of my head how long APNs certificates are, but if they're less than 4 KB, then you could add it as a Lambda environment variable and read it into a temporary file on startup (in settings.py
).
If they're larger than 4 KB, you could store the certificate in S3 and then download it to a temporary file on startup:
QUESTION
snap of error is here which I am getting while I am migrate
First I've installed this package using pip install django-push-notifications after that I've removed this package through pip uninstall django-push-notifications after that when I've tried migrating this. I am getting this error
...ANSWER
Answered 2019-Feb-21 at 06:02You have uninstalled the module, therefore Django could not find it. Thats why it's giving error.
If you have uninstalled the module, please remove push_notifications
present in INSTALLED_APPS
of your settings.py
file
QUESTION
Firebase Server sends notification, I get it, but my MyFirebaseMessagingService's onMessageReceived is not being called.
This is MyFirebaseMessagingService:
...ANSWER
Answered 2018-Apr-20 at 13:51The server part of the app was trying to send as Notification Message. This is what was causing the issue, and after I figured this out, I talked with the backend guy, in order to change the code to use Data Message, and now it works
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install django-push-notifications
You can use django-push-notifications like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page