GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Merge pull request #23 from jkseppan/fix_htpps_imread · matplotlib/matplotlib@cefa068

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/matplotlib
    • __init__.py
    • image.py
  • setup.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/matplotlib/__init__.py‎

Copy file name to clipboardExpand all lines: lib/matplotlib/__init__.py
+8-1Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,11 +761,18 @@ def is_url(filename):
761761
return URL_REGEX.match(filename) is not None
762762

763763

764+
@functools.lru_cache()
765+
def _get_ssl_context():
766+
import certifi
767+
import ssl
768+
return ssl.create_default_context(cafile=certifi.where())
769+
770+
764771
@contextlib.contextmanager
765772
def _open_file_or_url(fname):
766773
if not isinstance(fname, Path) and is_url(fname):
767774
import urllib.request
768-
with urllib.request.urlopen(fname) as f:
775+
with urllib.request.urlopen(fname, context=_get_ssl_context()) as f:
769776
yield (line.decode('utf-8') for line in f)
770777
else:
771778
fname = os.path.expanduser(fname)
Collapse file

‎lib/matplotlib/image.py‎

Copy file name to clipboardExpand all lines: lib/matplotlib/image.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1475,7 +1475,8 @@ def imread(fname, format=None):
14751475
if len(parsed.scheme) > 1: # Pillow doesn't handle URLs directly.
14761476
# hide imports to speed initial import on systems with slow linkers
14771477
from urllib import request
1478-
with request.urlopen(fname) as response:
1478+
with request.urlopen(fname,
1479+
context=mpl._get_ssl_context()) as response:
14791480
import io
14801481
try:
14811482
response.seek(0)
Collapse file

‎setup.py‎

Copy file name to clipboardExpand all lines: setup.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ def build_extensions(self):
278278
"numpy>=1.15",
279279
],
280280
install_requires=[
281+
"certifi>=2020.06.20",
281282
"cycler>=0.10",
282283
"kiwisolver>=1.0.1",
283284
"numpy>=1.16",

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.