在此代码中,我尝试将证书 .key 和 .pem 文件用于我有权使用的私有页面。
from OpenSSL import SSL
from twisted.internet import ssl
class BrowserLikeContextFactory(ScrapyClientContextFactory):
def creatorForNetloc(self, hostname, port):
certificate = ssl.DefaultOpenSSLContextFactory('path\\sample.key','path\\sample.pem')
return optionsForClientTLS(hostname.decode("ascii"),
trustRoot=platformTrust(),
clientCertificate=certificate,
extraCertificateOptions={
'method': self._ssl_method,
})
这两个文件存在于指定的路径中。我在 Scrapy 中尝试了一个 fetch 命令,这是第一个结果。
但是,在输入 PEM 密码后,遇到了这个错误?我该如何解决这个问题?

