Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions eventlib/green/urllib.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
from urllib.error import( __all__ )
from urllib.response import( __all__ )
from urllib.robotparser import( __all__ )
from urllib.request import( __all__, __version__, MAXFTPCACHE, ftpcache, ftpwrapper, _noheaders, noheaders, proxy_bypass, addinfourl, url2pathname, getproxies)
try:
from urllib.request import( __all__, __version__, MAXFTPCACHE, ftpcache, ftpwrapper, _noheaders, noheaders, proxy_bypass, addinfourl, url2pathname, getproxies)
except ImportError:
from urllib.request import( __all__, __version__, ftpwrapper, _noheaders, noheaders, proxy_bypass, addinfourl, url2pathname, getproxies)
MAXFTPCACHE = 10
ftpcache = {}
from urllib.parse import( __all__, quote, unwrap, unquote, splithost, splituser, splittype, splitattr, splitpasswd, splitport, splitquery, splitvalue)
from urllib.parse import urljoin as basejoin

Expand Down Expand Up @@ -41,7 +46,16 @@ def urlcleanup():
_urlopener.cleanup()


class URLopener(urllib.request.URLopener):
try:
_URLopener = urllib.request.URLopener
_FancyURLopener = urllib.request.FancyURLopener
except AttributeError:
class _URLopener(object):
def __init__(self, *args, **kwargs): pass
class _FancyURLopener(_URLopener):
pass

class URLopener(_URLopener):

def open_http(self, url, data=None):
"""Use HTTP protocol."""
Expand Down