add 'downloader.http.verify' option
(also: change the default 'timeout' from None to 30)
This commit is contained in:
@@ -105,12 +105,27 @@ downloader.http.timeout
|
|||||||
-----------------------
|
-----------------------
|
||||||
=========== =====
|
=========== =====
|
||||||
Type ``float`` or ``null``
|
Type ``float`` or ``null``
|
||||||
Default ``null``
|
Default ``30``
|
||||||
Description Amount of time (in seconds) to wait for a successful connection
|
Description Amount of time (in seconds) to wait for a successful connection
|
||||||
and a response from a remote server.
|
and response from a remote server.
|
||||||
|
|
||||||
This value gets internally used as the ``timeout`` parameter for the
|
This value gets internally used as the |timeout|_ parameter for the
|
||||||
|requests.get()|_ method.
|
|requests.request()|_ method during downloads.
|
||||||
|
=========== =====
|
||||||
|
|
||||||
|
|
||||||
|
downloader.http.verify
|
||||||
|
----------------------
|
||||||
|
=========== =====
|
||||||
|
Type ``bool`` or ``string``
|
||||||
|
Default ``true``
|
||||||
|
Description Controls whether to verify SSL/TLS certificates for HTTPS requests.
|
||||||
|
|
||||||
|
If this is a ``string``, it must be the path to a CA bundle to use
|
||||||
|
instead of the default certificates.
|
||||||
|
|
||||||
|
This value gets internally used as the |verify|_ parameter for the
|
||||||
|
|requests.request()|_ method during downloads.
|
||||||
=========== =====
|
=========== =====
|
||||||
|
|
||||||
|
|
||||||
@@ -302,7 +317,7 @@ Type ``float``
|
|||||||
Default ``3.0``
|
Default ``3.0``
|
||||||
Description Minimum wait time in seconds between each image
|
Description Minimum wait time in seconds between each image
|
||||||
|
|
||||||
Exhentai detects and blocks automated downloaders.
|
ExHentai detects and blocks automated downloaders.
|
||||||
``gallery-dl`` waits a randomly selected number of
|
``gallery-dl`` waits a randomly selected number of
|
||||||
seconds between ``wait-min`` and ``wait-max`` after
|
seconds between ``wait-min`` and ``wait-max`` after
|
||||||
each image to prevent getting blocked.
|
each image to prevent getting blocked.
|
||||||
@@ -380,7 +395,7 @@ extractor.imgur.mp4
|
|||||||
=========== =====
|
=========== =====
|
||||||
Type ``bool`` or ``string``
|
Type ``bool`` or ``string``
|
||||||
Default ``true``
|
Default ``true``
|
||||||
Description Controls whether to choose the GIF or MP4 version of an animation
|
Description Controls whether to choose the GIF or MP4 version of an animation.
|
||||||
|
|
||||||
* ``true``: Follow Imgur's advice and choose MP4 if the
|
* ``true``: Follow Imgur's advice and choose MP4 if the
|
||||||
``prefer_video`` flag in an image's metadata is set.
|
``prefer_video`` flag in an image's metadata is set.
|
||||||
@@ -538,7 +553,9 @@ Description The ``refresh_token`` value you get from linking your Reddit account
|
|||||||
|
|
||||||
.. |.netrc| replace:: ``.netrc``
|
.. |.netrc| replace:: ``.netrc``
|
||||||
.. |tempfile.gettempdir()| replace:: ``tempfile.gettempdir()``
|
.. |tempfile.gettempdir()| replace:: ``tempfile.gettempdir()``
|
||||||
.. |requests.get()| replace:: ``requests.get()``
|
.. |requests.request()| replace:: ``requests.request()``
|
||||||
|
.. |timeout| replace:: ``timeout``
|
||||||
|
.. |verify| replace:: ``verify``
|
||||||
.. |mature_content| replace:: ``mature_content``
|
.. |mature_content| replace:: ``mature_content``
|
||||||
.. |webbrowser.open()| replace:: ``webbrowser.open()``
|
.. |webbrowser.open()| replace:: ``webbrowser.open()``
|
||||||
.. |datetime.max| replace:: ``datetime.max``
|
.. |datetime.max| replace:: ``datetime.max``
|
||||||
@@ -550,7 +567,9 @@ Description The ``refresh_token`` value you get from linking your Reddit account
|
|||||||
|
|
||||||
.. _.netrc: https://stackoverflow.com/tags/.netrc/info
|
.. _.netrc: https://stackoverflow.com/tags/.netrc/info
|
||||||
.. _tempfile.gettempdir(): https://docs.python.org/3/library/tempfile.html#tempfile.gettempdir
|
.. _tempfile.gettempdir(): https://docs.python.org/3/library/tempfile.html#tempfile.gettempdir
|
||||||
.. _requests.get(): https://docs.python-requests.org/en/latest/user/advanced/#timeouts
|
.. _requests.request(): https://docs.python-requests.org/en/master/api/#requests.request
|
||||||
|
.. _timeout: https://docs.python-requests.org/en/latest/user/advanced/#timeouts
|
||||||
|
.. _verify: https://docs.python-requests.org/en/master/user/advanced/#ssl-cert-verification
|
||||||
.. _format string: https://docs.python.org/3/library/string.html#formatstrings
|
.. _format string: https://docs.python.org/3/library/string.html#formatstrings
|
||||||
.. _format strings: https://docs.python.org/3/library/string.html#formatstrings
|
.. _format strings: https://docs.python.org/3/library/string.html#formatstrings
|
||||||
.. _strptime: https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior
|
.. _strptime: https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior
|
||||||
|
|||||||
@@ -6,7 +6,8 @@
|
|||||||
"http":
|
"http":
|
||||||
{
|
{
|
||||||
"retries": 5,
|
"retries": 5,
|
||||||
"timeout": null
|
"timeout": 30,
|
||||||
|
"verify": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"extractor":
|
"extractor":
|
||||||
@@ -36,7 +37,12 @@
|
|||||||
"wait-max": 6,
|
"wait-max": 6,
|
||||||
"original": true,
|
"original": true,
|
||||||
"username": null,
|
"username": null,
|
||||||
"password": null
|
"password": null,
|
||||||
|
"cookies": {
|
||||||
|
"igneous": null,
|
||||||
|
"s": null,
|
||||||
|
"yay": "louder"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"nijie":
|
"nijie":
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ log = logging.getLogger("http")
|
|||||||
class Downloader(BasicDownloader):
|
class Downloader(BasicDownloader):
|
||||||
|
|
||||||
retries = config.interpolate(("downloader", "http", "retries",), 5)
|
retries = config.interpolate(("downloader", "http", "retries",), 5)
|
||||||
timeout = config.interpolate(("downloader", "http", "timeout",), None)
|
timeout = config.interpolate(("downloader", "http", "timeout",), 30)
|
||||||
|
verify = config.interpolate(("downloader", "http", "verify",), True)
|
||||||
|
|
||||||
def __init__(self, session, output):
|
def __init__(self, session, output):
|
||||||
BasicDownloader.__init__(self)
|
BasicDownloader.__init__(self)
|
||||||
@@ -42,7 +43,7 @@ class Downloader(BasicDownloader):
|
|||||||
# try to connect to remote source
|
# try to connect to remote source
|
||||||
try:
|
try:
|
||||||
response = self.session.get(
|
response = self.session.get(
|
||||||
url, stream=True, timeout=self.timeout
|
url, stream=True, timeout=self.timeout, verify=self.verify,
|
||||||
)
|
)
|
||||||
except (rexcepts.ConnectionError, rexcepts.Timeout) as exception:
|
except (rexcepts.ConnectionError, rexcepts.Timeout) as exception:
|
||||||
msg = exception
|
msg = exception
|
||||||
|
|||||||
Reference in New Issue
Block a user