forked from pool/python-pywebpush
* feat: Add a async_webpush one call func
* set license classifier
* chore: Update to modern python practices (well, Python 3.8)
* Webpusher.encode will now return a NoData exception if no data is
present to encode
- Refresh patch no-more-six.patch from upstream.
- Add patch use-unittest-mock.patch:
* Use unittest.mock rather than mock.
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pywebpush?expand=0&rev=10
58 lines
2.1 KiB
Diff
58 lines
2.1 KiB
Diff
From bb664d9862f1aa427744e34c51e7f2c1a8f35e15 Mon Sep 17 00:00:00 2001
|
|
From: jrconlin <jr+git@mozilla.com>
|
|
Date: Fri, 14 Jun 2024 14:25:02 -0700
|
|
Subject: [PATCH] bug: remove six requirement, add license classifer
|
|
|
|
There are a few other "poetry" related changes
|
|
that should be made, but I'm skipping those for
|
|
now.
|
|
|
|
Closes #166, 167
|
|
---
|
|
pyproject.toml | 9 ++++++++-
|
|
pywebpush/__init__.py | 5 ++---
|
|
requirements.txt | 1 -
|
|
setup.py | 2 +-
|
|
4 files changed, 11 insertions(+), 6 deletions(-)
|
|
|
|
Index: pywebpush-2.1.0/pywebpush/__init__.py
|
|
===================================================================
|
|
--- pywebpush-2.1.0.orig/pywebpush/__init__.py
|
|
+++ pywebpush-2.1.0/pywebpush/__init__.py
|
|
@@ -19,7 +19,6 @@ except ImportError: # pragma nocover
|
|
import aiohttp
|
|
import http_ece
|
|
import requests
|
|
-import six
|
|
from cryptography.hazmat.backends import default_backend
|
|
from cryptography.hazmat.primitives.asymmetric import ec
|
|
from cryptography.hazmat.primitives import serialization
|
|
@@ -175,7 +174,7 @@ class WebPusher:
|
|
for k in ["p256dh", "auth"]:
|
|
if keys.get(k) is None:
|
|
raise WebPushException("Missing keys value: {}".format(k))
|
|
- if isinstance(keys[k], six.text_type):
|
|
+ if isinstance(keys[k], str):
|
|
keys[k] = bytes(cast(str, keys[k]).encode("utf8"))
|
|
receiver_raw = base64.urlsafe_b64decode(
|
|
self._repad(cast(bytes, keys["p256dh"]))
|
|
@@ -236,7 +235,7 @@ class WebPusher:
|
|
format=serialization.PublicFormat.UncompressedPoint,
|
|
)
|
|
|
|
- if isinstance(data, six.text_type):
|
|
+ if isinstance(data, str):
|
|
data = bytes(data.encode("utf8"))
|
|
if content_encoding == "aes128gcm":
|
|
self.verb("Encrypting to aes128gcm...")
|
|
Index: pywebpush-2.1.0/requirements.txt
|
|
===================================================================
|
|
--- pywebpush-2.1.0.orig/requirements.txt
|
|
+++ pywebpush-2.1.0/requirements.txt
|
|
@@ -2,5 +2,4 @@ aiohttp
|
|
cryptography>=2.6.1
|
|
http-ece>=1.1.0
|
|
requests>=2.21.0
|
|
-six>=1.15.0
|
|
py-vapid>=1.7.0
|