Merge branch 'master' into HEAD

This commit is contained in:
Calum Lind 2013-11-19 23:03:14 +00:00
commit 3d569b23d6
1 changed files with 11 additions and 1 deletions

View File

@ -196,7 +196,17 @@ def download_file(url, filename, callback=None, headers=None,
headers = {}
headers["accept-encoding"] = "deflate, gzip, x-gzip"
scheme, host, port, path = client._parse(url)
# In twisted 13.1.0 the _parse() function was replaced by the _URI class
if hasattr(client, '_parse'):
scheme, host, port, path = client._parse(url)
else:
from twisted.web.client import _URI
uri = _URI.fromBytes(url)
scheme = uri.scheme
host = uri.host
port = uri.port
path = uri.path
factory = HTTPDownloader(url, filename, callback, headers, force_filename, allow_compression)
if scheme == "https":
from twisted.internet import ssl