We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 110be71 + 14331e4 commit 24d746bCopy full SHA for 24d746b
pywebpush/__init__.py
@@ -6,6 +6,7 @@
6
from copy import deepcopy
7
import json
8
import os
9
+import time
10
11
try:
12
from urllib.parse import urlparse
@@ -380,6 +381,9 @@ def webpush(subscription_info,
380
381
url = urlparse(subscription_info.get('endpoint'))
382
aud = "{}://{}".format(url.scheme, url.netloc)
383
vapid_claims['aud'] = aud
384
+ if not vapid_claims.get('exp'):
385
+ # encryption lives for 12 hours
386
+ vapid_claims['exp'] = int(time.time()) + (12 * 60 * 60)
387
if not vapid_private_key:
388
raise WebPushException("VAPID dict missing 'private_key'")
389
if isinstance(vapid_private_key, Vapid):
0 commit comments