Remove some Python 2 compatibility code (#25341)

This commit is contained in:
Ville Skyttä 2019-07-20 16:04:18 +03:00 committed by Andrew Sayre
parent 22d9a73e8e
commit 258dc80fbd

View File

@ -2,6 +2,7 @@
from datetime import datetime, timedelta from datetime import datetime, timedelta
from functools import partial from functools import partial
from urllib.parse import urlparse
import json import json
import logging import logging
import time import time
@ -534,10 +535,6 @@ def add_jwt(timestamp, target, tag, jwt_secret):
def create_vapid_headers(vapid_email, subscription_info, vapid_private_key): def create_vapid_headers(vapid_email, subscription_info, vapid_private_key):
"""Create encrypted headers to send to WebPusher.""" """Create encrypted headers to send to WebPusher."""
from py_vapid import Vapid from py_vapid import Vapid
try:
from urllib.parse import urlparse
except ImportError: # pragma: no cover
from urlparse import urlparse
if (vapid_email and vapid_private_key and if (vapid_email and vapid_private_key and
ATTR_ENDPOINT in subscription_info): ATTR_ENDPOINT in subscription_info):
url = urlparse(subscription_info.get(ATTR_ENDPOINT)) url = urlparse(subscription_info.get(ATTR_ENDPOINT))