1
0
mirror of https://github.com/scrapy/scrapy.git synced 2025-02-25 12:24:19 +00:00

Ignore HTTPS certificate verification failures

Fixes #1930
This commit is contained in:
Paul Tremberth 2016-04-14 00:12:25 +02:00
parent ba6dbad1e0
commit a087d2593a

View File

@ -1,6 +1,7 @@
from OpenSSL import SSL
from twisted.internet.ssl import ClientContextFactory
try:
from zope.interface.declarations import implementer
@ -11,6 +12,12 @@ try:
from twisted.web.client import BrowserLikePolicyForHTTPS
from twisted.web.iweb import IPolicyForHTTPS
class ScrapyClientTLSOptions(ClientTLSOptions):
def _identityVerifyingInfoCallback(self, connection, where, ret):
pass
@implementer(IPolicyForHTTPS)
class ScrapyClientContextFactory(BrowserLikePolicyForHTTPS):
"""
@ -49,7 +56,7 @@ try:
return self.getCertificateOptions().getContext()
def creatorForNetloc(self, hostname, port):
return ClientTLSOptions(hostname.decode("ascii"), self.getContext())
return ScrapyClientTLSOptions(hostname.decode("ascii"), self.getContext())
@implementer(IPolicyForHTTPS)