From ffdf794246ab2711c5318e12859e2ef9f0960cf3 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 27 Dec 2020 10:18:01 +0530 Subject: [PATCH] Allow re-use of method to get any URL --- src/calibre/live.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/calibre/live.py b/src/calibre/live.py index d880f807a1..59cf795921 100644 --- a/src/calibre/live.py +++ b/src/calibre/live.py @@ -99,11 +99,12 @@ def parse_metadata(full_name, raw_bytes): return module_version, minimum_calibre_version -def fetch_module(full_name, etag=None, timeout=default_timeout): +def fetch_module(full_name, etag=None, timeout=default_timeout, url=None): if timeout is default_timeout: timeout = DEFAULT_TIMEOUT - path = '/'.join(full_name.split('.')) + '.py' - url = 'https://code.calibre-ebook.com/src/' + path + if url is None: + path = '/'.join(full_name.split('.')) + '.py' + url = 'https://code.calibre-ebook.com/src/' + path headers = {'accept-encoding': 'gzip'} if etag: headers['if-none-match'] = f'"{etag}"'