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 at /admin/push_notifications/apnsdevice/ when bulk sending test notification #567

Open
DataGreed opened this issue Mar 25, 2020 · 1 comment

Comments

@DataGreed
Copy link
Contributor

I use p8 cert with django-push-notifications 2.0.0

Whenever I go to admin site and try to send bulk push notification I get following error:

Environment:


Request Method: POST
Request URL: http://127.0.0.1:8000/admin/push_notifications/apnsdevice/

Django Version: 2.2.7
Python Version: 3.7.3
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'rest_framework',
 'rest_framework.authtoken',
 'adminsortable2',
 'push_notifications']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']



Traceback:

File "myproject/.env/lib/python3.7/site-packages/django/core/handlers/exception.py" in inner
  34.             response = get_response(request)

File "myproject/.env/lib/python3.7/site-packages/django/core/handlers/base.py" in _get_response
  115.                 response = self.process_exception_by_middleware(e, request)

File "myproject/.env/lib/python3.7/site-packages/django/core/handlers/base.py" in _get_response
  113.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "myproject/.env/lib/python3.7/site-packages/django/contrib/admin/options.py" in wrapper
  606.                 return self.admin_site.admin_view(view)(*args, **kwargs)

File "myproject/.env/lib/python3.7/site-packages/django/utils/decorators.py" in _wrapped_view
  142.                     response = view_func(request, *args, **kwargs)

File "myproject/.env/lib/python3.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  44.         response = view_func(request, *args, **kwargs)

File "myproject/.env/lib/python3.7/site-packages/django/contrib/admin/sites.py" in inner
  223.             return view(request, *args, **kwargs)

File "myproject/.env/lib/python3.7/site-packages/django/utils/decorators.py" in _wrapper
  45.         return bound_method(*args, **kwargs)

File "myproject/.env/lib/python3.7/site-packages/django/utils/decorators.py" in _wrapped_view
  142.                     response = view_func(request, *args, **kwargs)

File "myproject/.env/lib/python3.7/site-packages/django/contrib/admin/options.py" in changelist_view
  1698.                 response = self.response_action(request, queryset=cl.get_queryset(request))

File "myproject/.env/lib/python3.7/site-packages/django/contrib/admin/options.py" in response_action
  1397.             response = func(self, request, queryset)

File "myproject/.env/lib/python3.7/site-packages/push_notifications/admin.py" in send_bulk_message
  98. 		self.send_messages(request, queryset, True)

File "myproject/.env/lib/python3.7/site-packages/push_notifications/admin.py" in send_messages
  61. 				errors = [r["error"] for r in ret[0][0]["results"] if "error" in r]

Exception Type: KeyError at /admin/push_notifications/apnsdevice/
Exception Value: 'results'

Seems like the response format changed, there is no result key in this dict.
Sending messages not in bulk works flawlessly.

DataGreed added a commit to DataGreed/django-push-notifications that referenced this issue Mar 25, 2020
@Phishion
Copy link

Phishion commented Sep 1, 2021

same issue

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

No branches or pull requests

3 participants