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 aa66fde + ef54603 commit 14331e4Copy full SHA for 14331e4
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
@@ -378,6 +379,9 @@ def webpush(subscription_info,
378
379
url = urlparse(subscription_info.get('endpoint'))
380
aud = "{}://{}".format(url.scheme, url.netloc)
381
vapid_claims['aud'] = aud
382
+ if not vapid_claims.get('exp'):
383
+ # encryption lives for 12 hours
384
+ vapid_claims['exp'] = int(time.time()) + (12 * 60 * 60)
385
if not vapid_private_key:
386
raise WebPushException("VAPID dict missing 'private_key'")
387
if isinstance(vapid_private_key, Vapid):
0 commit comments