mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
593e4089bc
commit
7717572f6e
@ -192,24 +192,24 @@ class FetchBackend(QNetworkAccessManager):
|
|||||||
rq.setRawHeader(b'User-Agent', self.current_user_agent().encode())
|
rq.setRawHeader(b'User-Agent', self.current_user_agent().encode())
|
||||||
for (name, val) in req['headers']:
|
for (name, val) in req['headers']:
|
||||||
rq.setRawHeader(name.encode(), val.encode())
|
rq.setRawHeader(name.encode(), val.encode())
|
||||||
method = req['method'].lower()
|
qmethod = req['method'].lower()
|
||||||
data_path = req['data_path']
|
data_path = req['data_path']
|
||||||
data = None
|
data = None
|
||||||
if data_path:
|
if data_path:
|
||||||
with open(data_path, 'rb') as f:
|
with open(data_path, 'rb') as f:
|
||||||
data = f.read()
|
data = f.read()
|
||||||
if method == 'get':
|
if qmethod == 'get':
|
||||||
reply = self.get(rq, data)
|
reply = self.get(rq, data)
|
||||||
elif method == 'post':
|
elif qmethod == 'post':
|
||||||
reply = self.post(rq, data)
|
reply = self.post(rq, data)
|
||||||
elif method == 'put':
|
elif qmethod == 'put':
|
||||||
reply = self.put(rq, data)
|
reply = self.put(rq, data)
|
||||||
elif method == 'head':
|
elif qmethod == 'head':
|
||||||
reply = self.head(rq, data)
|
reply = self.head(rq, data)
|
||||||
elif method == 'delete':
|
elif qmethod == 'delete':
|
||||||
reply = self.deleteRequest(rq)
|
reply = self.deleteRequest(rq)
|
||||||
else:
|
else:
|
||||||
reply = self.sendCustomRequest(rq, method.encode(), data)
|
reply = self.sendCustomRequest(rq, req['method'].encode(), data)
|
||||||
dr = DownloadRequest(req['url'], os.path.join(self.output_dir, filename), reply, timeout, req['id'], self)
|
dr = DownloadRequest(req['url'], os.path.join(self.output_dir, filename), reply, timeout, req['id'], self)
|
||||||
self.live_requests.add(dr)
|
self.live_requests.add(dr)
|
||||||
if not self.timeout_timer.isActive():
|
if not self.timeout_timer.isActive():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user