mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-02 22:48:40 +00:00
Fix twisted 13.1 compat -- the _parse() function was replaced by the _URI class
This commit is contained in:
parent
289730a3e3
commit
852f6049bd
1 changed files with 11 additions and 1 deletions
|
@ -196,7 +196,17 @@ def download_file(url, filename, callback=None, headers=None,
|
||||||
headers = {}
|
headers = {}
|
||||||
headers["accept-encoding"] = "deflate, gzip, x-gzip"
|
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 import _URI
|
||||||
|
uri = _URI.fromBytes(url)
|
||||||
|
scheme = uri.scheme
|
||||||
|
host = uri.host
|
||||||
|
port = uri.port
|
||||||
|
path = uri.originFrom
|
||||||
|
|
||||||
factory = HTTPDownloader(url, filename, callback, headers, force_filename, allow_compression)
|
factory = HTTPDownloader(url, filename, callback, headers, force_filename, allow_compression)
|
||||||
if scheme == "https":
|
if scheme == "https":
|
||||||
from twisted.internet import ssl
|
from twisted.internet import ssl
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue