mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-23 06:35:24 -07:00
Search: Fix torrent download with Python 3
(cherry picked from commit 51b3a5164d
)
This commit is contained in:
parent
083cab3118
commit
6ee385bdd8
2 changed files with 3 additions and 3 deletions
|
@ -77,7 +77,7 @@ def retrieve_url(url):
|
||||||
def download_file(url, referer=None):
|
def download_file(url, referer=None):
|
||||||
""" Download file at url and write it to a file, return the path to the file and the url """
|
""" Download file at url and write it to a file, return the path to the file and the url """
|
||||||
file, path = tempfile.mkstemp()
|
file, path = tempfile.mkstemp()
|
||||||
file = os.fdopen(file, "w")
|
file = os.fdopen(file, "wb")
|
||||||
# Download url
|
# Download url
|
||||||
req = urllib.request.Request(url)
|
req = urllib.request.Request(url)
|
||||||
if referer is not None:
|
if referer is not None:
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import glob
|
import glob
|
||||||
from .helpers import download_file
|
from helpers import download_file
|
||||||
|
|
||||||
supported_engines = dict()
|
supported_engines = dict()
|
||||||
|
|
||||||
|
@ -61,4 +61,4 @@ if __name__ == '__main__':
|
||||||
engine.download_torrent(download_param)
|
engine.download_torrent(download_param)
|
||||||
else:
|
else:
|
||||||
print(download_file(download_param))
|
print(download_file(download_param))
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue