From 9433e6fc7ba4350203ea266a5825ce63c42a8447 Mon Sep 17 00:00:00 2001 From: Sachin Patil Date: Thu, 28 Jul 2016 21:09:52 +0530 Subject: [PATCH] Fixed request.exceptions.SSLError Bot throw SSLerror --- requests.packages.urllib3.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:645) --- even when 'verify_ssl = False' The core.verify_ssl was not passed to url.find_title() Signed-off-by: Sachin Patil --- sopel/modules/meetbot.py | 2 +- sopel/modules/url.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sopel/modules/meetbot.py b/sopel/modules/meetbot.py index f0c007f24f..35bf102fe2 100644 --- a/sopel/modules/meetbot.py +++ b/sopel/modules/meetbot.py @@ -342,7 +342,7 @@ def meetinglink(bot, trigger): if not link.startswith("http"): link = "http://" + link try: - title = find_title(link) + title = find_title(bot, link) except: title = '' logplain('LINK: %s [%s]' % (link, title), trigger.sender) diff --git a/sopel/modules/url.py b/sopel/modules/url.py index d2a83df848..52e20a7f73 100644 --- a/sopel/modules/url.py +++ b/sopel/modules/url.py @@ -158,7 +158,7 @@ def process_urls(bot, trigger, urls): if matched: continue # Finally, actually show the URL - title = find_title(url) + title = find_title(bot, url) if title: results.append((title, get_hostname(url))) return results @@ -182,9 +182,9 @@ def check_callbacks(bot, trigger, url, run=True): return matched -def find_title(url): +def find_title(bot, url): """Return the title for the given URL.""" - response = requests.get(url, stream=True) + response = requests.get(url, stream=True, verify=bot.config.core.verify_ssl) try: content = '' for byte in response.iter_content(chunk_size=512, decode_unicode=True):