Permalink
Browse files

Make urlparse imports Python 3 compatible (pattern.web)

Ideally, it would be better to listen for ModuleNotFoundError instead of ImportError, but since this is only available in Python >= 3.6 let's stick to
this for now.
  • Loading branch information...
markus-beuckelmann committed May 30, 2017
1 parent 75f40b7 commit 1e17011219711bb6dd330146b9159ec834560021
Showing with 13 additions and 2 deletions.
  1. +7 −1 pattern/web/__init__.py
  2. +6 −1 pattern/web/feed/feedparser.py
@@ -15,7 +15,13 @@
import sys
import threading
import time
import socket, urlparse, urllib, urllib2, ssl
import socket, urllib, urllib2, ssl
try:
# Python 2
import urlparse
except ImportError:
# Python 3
from urllib import parse as urlparse
import base64
import htmlentitydefs
import httplib
@@ -152,7 +152,12 @@ def _l2bytes(l):
import types
import urllib
import urllib2
import urlparse
try:
# Python 2
import urlparse
except ImportError:
# Python 3
from urllib import parse as urlparse
import warnings
from htmlentitydefs import name2codepoint, codepoint2name, entitydefs

0 comments on commit 1e17011

Please sign in to comment.