mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 12:54:11 +08:00
As the title stated. Pull Request resolved: https://github.com/pytorch/pytorch/pull/163846 Approved by: https://github.com/ezyang
27 lines
556 B
Python
27 lines
556 B
Python
# cf. https://github.com/pypa/manylinux/issues/53
|
|
|
|
import sys
|
|
from urllib.request import urlopen
|
|
|
|
|
|
GOOD_SSL = "https://google.com"
|
|
BAD_SSL = "https://self-signed.badssl.com"
|
|
|
|
|
|
print("Testing SSL certificate checking for Python:", sys.version)
|
|
|
|
EXC = OSError
|
|
|
|
print(f"Connecting to {GOOD_SSL} should work")
|
|
urlopen(GOOD_SSL)
|
|
print("...it did, yay.")
|
|
|
|
print(f"Connecting to {BAD_SSL} should fail")
|
|
try:
|
|
urlopen(BAD_SSL)
|
|
# If we get here then we failed:
|
|
print("...it DIDN'T!!!!!11!!1one!")
|
|
sys.exit(1)
|
|
except EXC:
|
|
print("...it did, yay.")
|