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

KeyError: 'endpoint' when using admin interface to send notification #50

Closed
gnalbandian opened this issue Oct 23, 2018 · 2 comments · Fixed by #63
Closed

KeyError: 'endpoint' when using admin interface to send notification #50

gnalbandian opened this issue Oct 23, 2018 · 2 comments · Fixed by #63

Comments

@gnalbandian
Copy link

gnalbandian commented Oct 23, 2018

Hi, I have installed the package and generated the needed keys. I subscribed myself to receive notifications with an account without issues up till then.

When I log to the django admin interface and try to send a message to test if it works I get the following error.

File "/home/socialapp/deepmetricsapps/NuevocentroShopping/lib/python3.5/site-packages/webpush/utils.py", line 71, in _process_subscription_info endpoint = subscription_data.pop("endpoint") KeyError: 'endpoint'

Is this package still working? or am I doing something wrong?
I am using Django 2.0+ with gunicorn and nginx as reverse proxy. I subscribed to the service using chrome 70+

@ckangnz
Copy link
Contributor

ckangnz commented May 1, 2019

You need to change this in admin.py

for device in queryset:
   #from this
   result.append(_send_notification(device, json.dumps(payload), 0))
   #to this
   result.append(_send_notification(device.subscription, json.dumps(payload), 0))

@safwanrahman
Copy link
Owner

Thanks for the report. Sorry it took so long to make a small fix!

safwanrahman added a commit that referenced this issue Jun 2, 2019
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

Successfully merging a pull request may close this issue.

3 participants