Comments (7)
from pywebpush.
@ishwara-bhat I have the same problem, how could you solve it?
from pywebpush.
Reading the dump, it appears that the problem is that http_ece
can't encrypt content
.
content
comes from data
in self.encode(data, content_encoding)
from a very quick view, I'm going to guess that the data being passed in is not a byte array. You may need to serialize the object content into a string or byte array before passing it to webpush.encode
from pywebpush.
Reading the dump, it appears that the problem is that
http_ece
can't encryptcontent
.content
comes fromdata
inself.encode(data, content_encoding)
from a very quick view, I'm going to guess that the data being passed in is not a byte array. You may need to serialize the object content into a string or byte array before passing it to
webpush.encode
An example of a key pair that I am using are the following. I am using string strings directly.
{
"subject": "mailto: [email protected]",
"publicKey": "BLR4PgElXtaeu16JlFEfVuOZkyub-Y36w1XRDYvl7-gNOKUpW-YadhR0Yv6vnrz5h4HhJG5jq0arBRuIrJdWXtQ",
"privateKey": "LqUduWL7V0F7pOrYep5oTgZJaCXLl7eRvMZMpAE6DCA"
}
Is it necessary to use PEM certificates or can I use string keys?
from pywebpush.
String keys can be in either raw or DER format: https://github.com/web-push-libs/vapid/blob/main/python/py_vapid/__init__.py#L134-L147. If you provide a path, py_vapid will try to read the file as either PEM or DER formatted https://github.com/web-push-libs/vapid/blob/main/python/py_vapid/__init__.py#L134-L147
from pywebpush.
Las claves de cadena pueden estar en formato raw o DER: https://github.com/web-push-libs/vapid/blob/main/python/py_vapid/__init__.py#L134-L147 . Si proporciona una ruta, py_vapid intentará leer el archivo con formato PEM o DER https://github.com/web-push-libs/vapid/blob/main/python/py_vapid/__init__.py#L134-L147
Ok, I will try to work with the private key in PEM format from the file directly.
from pywebpush.
Just ran into this same issue. Make sure your data
payload is JSON string encoded and not just a raw python dictionary.
from pywebpush.
Related Issues (20)
- KaiOS support HOT 4
- Send Bulk Push to multiple devices HOT 2
- Send Push to Offline Devices (When it comes Online) HOT 7
- Feature: get the encoded data ready for sending (for async interop) HOT 1
- use unittest.mock instead of mock
- JWT token being refreshed too often HOT 8
- Error : Web push send from python backend HOT 4
- Async Send Function HOT 1
- Unauthorized error while sending notifications to edge device
- Is the library being maintained HOT 2
- Grouping of multiple notification not working
- Defination of payload HOT 1
- netrc may override authorization header.
- How to set the `aud` for localhost HOT 2
- CryptographyDeprecationWarning: Curve Argument Type Issue in pywebpush
- For edge, I only get 400 Bad Request. I tested it in webpush library for node. It works properly. HOT 4
- 400 Bad Request when using Windows Push Notification Services (WNS) endpoint HOT 8
- Is there a way to set topic for replacing old messages? HOT 1
- No error thrown, but no push notifications received HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pywebpush.