Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions newspaper/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def __init__(self):
self.request_timeout = 7
self.proxies = {}
self.number_threads = 10
self.verify_ssl_cert = True

self.verbose = False # for debugging

Expand Down
8 changes: 5 additions & 3 deletions newspaper/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
FAIL_ENCODING = 'ISO-8859-1'


def get_request_kwargs(timeout, useragent, proxies, headers, allow_redirects):
def get_request_kwargs(timeout, useragent, proxies, headers, allow_redirects, verify_ssl_cert):
"""This Wrapper method exists b/c some values in req_kwargs dict
are methods which need to be called every time we make a request
"""
Expand All @@ -30,7 +30,8 @@ def get_request_kwargs(timeout, useragent, proxies, headers, allow_redirects):
'cookies': cj(),
'timeout': timeout,
'allow_redirects': allow_redirects,
'proxies': proxies
'proxies': proxies,
'verify': verify_ssl_cert,
}


Expand All @@ -55,6 +56,7 @@ def get_html_2XX_only(url, config=None, response=None, return_final_url=False):
timeout = config.request_timeout
proxies = config.proxies
headers = config.headers
verify_ssl_cert = config.verify_ssl_cert
allow_redirects = config.allow_redirects

if response is not None:
Expand All @@ -64,7 +66,7 @@ def get_html_2XX_only(url, config=None, response=None, return_final_url=False):
return html

response = requests.get(
url=url, **get_request_kwargs(timeout, useragent, proxies, headers, allow_redirects))
url=url, **get_request_kwargs(timeout, useragent, proxies, headers, allow_redirects, verify_ssl_cert))

html = _get_html_from_response(response, config)
final_url = response.url
Expand Down