From 1a3823320057144acc1a445559ae5b6e4cdd20bf Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 12 Aug 2022 12:29:29 -0400 Subject: [PATCH] [pre-commit.ci] pre-commit autoupdate (#668) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/asottile/pyupgrade: v2.37.2 → v2.37.3](https://github.com/asottile/pyupgrade/compare/v2.37.2...v2.37.3) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .github/workflows/release.yml | 2 +- .github/workflows/test.yml | 2 +- README.rst | 2 -- push_notifications/conf/__init__.py | 2 +- push_notifications/conf/app.py | 3 ++- push_notifications/gcm.py | 1 - push_notifications/migrations/0001_initial.py | 1 + push_notifications/migrations/0002_auto_20160106_0850.py | 1 + push_notifications/migrations/0003_wnsdevice.py | 1 + push_notifications/migrations/0004_fcm.py | 1 + push_notifications/migrations/0005_applicationid.py | 1 + push_notifications/migrations/0006_webpushdevice.py | 1 + push_notifications/settings.py | 5 ----- setup.cfg | 1 + tests/test_legacy_config.py | 1 + 15 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7443eabc..6bc4cf99 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,7 +8,7 @@ on: jobs: build: if: github.repository == 'jazzband/django-push-notifications' - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 75779548..c5400c3b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,7 +5,7 @@ on: [push, pull_request] jobs: build: name: build (Python ${{ matrix.python-version }}, Django ${{ matrix.django-version }}) - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest strategy: fail-fast: false matrix: diff --git a/README.rst b/README.rst index 41b66bb6..042d4e31 100644 --- a/README.rst +++ b/README.rst @@ -308,7 +308,6 @@ When creating an ``APNSDevice``, the ``registration_id`` is validated to be a 64 Routes can be added one of two ways: - Routers_ (include all views) - .. _Routers: http://www.django-rest-framework.org/tutorial/6-viewsets-and-routers#using-routers :: @@ -327,7 +326,6 @@ Routes can be added one of two ways: ) - Using as_view_ (specify which views to include) - .. _as_view: http://www.django-rest-framework.org/tutorial/6-viewsets-and-routers#binding-viewsets-to-urls-explicitly :: diff --git a/push_notifications/conf/__init__.py b/push_notifications/conf/__init__.py index e11f28fb..4e798ccd 100644 --- a/push_notifications/conf/__init__.py +++ b/push_notifications/conf/__init__.py @@ -1,9 +1,9 @@ from django.utils.module_loading import import_string -from ..settings import PUSH_NOTIFICATIONS_SETTINGS as SETTINGS # noqa: I001 from .app import AppConfig # noqa: F401 from .appmodel import AppModelConfig # noqa: F401 from .legacy import LegacyConfig # noqa: F401 +from ..settings import PUSH_NOTIFICATIONS_SETTINGS as SETTINGS # noqa: I001 manager = None diff --git a/push_notifications/conf/app.py b/push_notifications/conf/app.py index a70aa1f5..308b53eb 100644 --- a/push_notifications/conf/app.py +++ b/push_notifications/conf/app.py @@ -25,6 +25,7 @@ PLATFORMS = [ "APNS", "FCM", + "GCM", "WNS", "WP", ] @@ -170,7 +171,7 @@ def _validate_apns_certificate(self, certfile): """Validate the APNS certificate at startup.""" try: - with open(certfile) as f: + with open(certfile, "r") as f: content = f.read() check_apns_certificate(content) except Exception as e: diff --git a/push_notifications/gcm.py b/push_notifications/gcm.py index e2f9d537..923322e9 100644 --- a/push_notifications/gcm.py +++ b/push_notifications/gcm.py @@ -16,7 +16,6 @@ # Valid keys for FCM messages. Reference: # https://firebase.google.com/docs/cloud-messaging/http-server-ref - FCM_NOTIFICATIONS_PAYLOAD_KEYS = [ "title", "body", "icon", "image", "sound", "badge", "color", "tag", "click_action", "body_loc_key", "body_loc_args", "title_loc_key", "title_loc_args", "android_channel_id" diff --git a/push_notifications/migrations/0001_initial.py b/push_notifications/migrations/0001_initial.py index eca6aefd..14033f16 100644 --- a/push_notifications/migrations/0001_initial.py +++ b/push_notifications/migrations/0001_initial.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from django.conf import settings from django.db import migrations, models diff --git a/push_notifications/migrations/0002_auto_20160106_0850.py b/push_notifications/migrations/0002_auto_20160106_0850.py index 8c0373dd..37bb9f8f 100644 --- a/push_notifications/migrations/0002_auto_20160106_0850.py +++ b/push_notifications/migrations/0002_auto_20160106_0850.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # Generated by Django 1.9.1 on 2016-01-06 08:50 from django.db import migrations, models diff --git a/push_notifications/migrations/0003_wnsdevice.py b/push_notifications/migrations/0003_wnsdevice.py index 2ac1dad9..6c6b5c3a 100644 --- a/push_notifications/migrations/0003_wnsdevice.py +++ b/push_notifications/migrations/0003_wnsdevice.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # Generated by Django 1.9.6 on 2016-06-13 20:46 import django.db.models.deletion from django.conf import settings diff --git a/push_notifications/migrations/0004_fcm.py b/push_notifications/migrations/0004_fcm.py index c08c28c1..be35f4c4 100644 --- a/push_notifications/migrations/0004_fcm.py +++ b/push_notifications/migrations/0004_fcm.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # Generated by Django 1.9.6 on 2016-06-13 20:46 from django.conf import settings from django.db import migrations, models diff --git a/push_notifications/migrations/0005_applicationid.py b/push_notifications/migrations/0005_applicationid.py index 443c173d..79b5919e 100644 --- a/push_notifications/migrations/0005_applicationid.py +++ b/push_notifications/migrations/0005_applicationid.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from django.conf import settings from django.db import migrations, models diff --git a/push_notifications/migrations/0006_webpushdevice.py b/push_notifications/migrations/0006_webpushdevice.py index 524cf6bc..c63c2490 100644 --- a/push_notifications/migrations/0006_webpushdevice.py +++ b/push_notifications/migrations/0006_webpushdevice.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from django.conf import settings from django.db import migrations, models diff --git a/push_notifications/settings.py b/push_notifications/settings.py index 1d86ec02..742063d5 100644 --- a/push_notifications/settings.py +++ b/push_notifications/settings.py @@ -27,11 +27,6 @@ ) # WP (WebPush) - -PUSH_NOTIFICATIONS_SETTINGS.setdefault( - "FCM_POST_URL", "https://fcm.googleapis.com/fcm/send" -) - PUSH_NOTIFICATIONS_SETTINGS.setdefault("WP_POST_URL", { "CHROME": PUSH_NOTIFICATIONS_SETTINGS["FCM_POST_URL"], "OPERA": PUSH_NOTIFICATIONS_SETTINGS["FCM_POST_URL"], diff --git a/setup.cfg b/setup.cfg index 99dfc8c8..dbf50936 100644 --- a/setup.cfg +++ b/setup.cfg @@ -37,6 +37,7 @@ setup_requires = APNS = apns2>=0.3.0 importlib-metadata;python_version < "3.8" + pywebpush>=1.3.0 Django>=2.2 WP = pywebpush>=1.3.0 diff --git a/tests/test_legacy_config.py b/tests/test_legacy_config.py index 0cd91f24..f441d425 100644 --- a/tests/test_legacy_config.py +++ b/tests/test_legacy_config.py @@ -3,6 +3,7 @@ from django.test import TestCase from push_notifications.conf import get_manager +from push_notifications.conf.legacy import LegacyConfig from push_notifications.exceptions import WebPushError from push_notifications.webpush import webpush_send_message