On Fri, Dec 01, 2017 at 10:00:11AM +0100, Andreas Tille wrote:
> Hallo,
>
> führe ich folgenden Python-Code
>
> #!/usr/bin/python3
>
> import urllib.request, urllib.error, urllib.parse
> import sys
>
> url="https://invalid.certificate.local/"
>
> try:
> response = urllib.request.urlopen(url)
> except urllib.error.URLError as err:
> sys.stderr.write('Unable to read URL %s\n' % url)
> sys.stderr.write(str(err)+'\n')
> exit(1)
>
> print("URL %s successfully opened" % url)
Ich habe auch ein Skript, das auf einen https-Server mit einem
StartSSL-Cert zugreifen muss, das Python nicht mag. Bei mir geht das so:
import urllib.request
import ssl
context = ssl.create_default_context()
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE
with urllib.request.urlopen(url, context=context) as ...
Vielleicht hilft Dir das ja ...
Liebe Grüße aus Freiburg
Uwe
Attachment:
signature.asc
Description: PGP signature