Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

requirements, url: adapt to urllib3 exception type change #1989

Merged
merged 1 commit into from
Nov 14, 2020
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
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ geoip2>=4.0,<5.0; python_version >= '3.6'
maxminddb<2.0; python_version < '3.6'
ipaddress<2.0; python_version < '3.3'
requests>=2.0.0,<3.0.0
# transitive dependency of requests
# 2.0 will drop EOL Python 2.7 & 3.5, just like Sopel 8 plans to
urllib3<1.27; python_version != '3.3' and python_version != '3.4'
urllib3<1.23; python_version == '3.3'
urllib3<1.25; python_version == '3.4'
dnspython<2.0; python_version == '2.7'
dnspython<1.16.0; python_version == '3.3'
dnspython<3.0; python_version >= '3.4'
Expand Down
4 changes: 3 additions & 1 deletion sopel/modules/url.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import dns.resolver
import requests
from urllib3.exceptions import LocationValueError

from sopel import plugin, tools
from sopel.config import types
Expand Down Expand Up @@ -325,7 +326,8 @@ def find_title(url, verify=True):
return None
except (
requests.exceptions.InvalidURL, # e.g. http:///
UnicodeError, # e.g. http://.example.com
UnicodeError, # e.g. http://.example.com (urllib3<1.26)
LocationValueError, # e.g. http://.example.com (urllib3>=1.26)
):
LOGGER.debug('Invalid URL: %s', url)
return None
Expand Down