Python请求不遵守verify = False

时间:2016-03-15 14:51:46

标签: python ssl python-requests

即使在verify = False时,Python请求也会给我一个ssl握手失败(我知道不使用SSL是不可取的)。对于我和其他具有有效证书的站点,请求按预期工作。我使用2.7。

from lxml import html
import requests
import csv

outputfile  = open('/Users/jim/Documents/FabFoundationURLs.csv', "wb")
writer = csv.writer(outputfile, delimiter=';', quotechar='"', quoting=csv.QUOTE_MINIMAL)

source = 'https://www.fablabs.io/labs'

page = requests.get(source, verify=False)
tree = html.fromstring(page.content)

#This will create a list of links:
links = tree.xpath('/html/body/div[@id="main"]/div[2]/div[1]/div[2]//span/a/text()')

targets = links

print links

这是例外:

SSLError: [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:590) 

1 个答案:

答案 0 :(得分:0)

SSL握手错误可以是协议错误,而不是证书验证错误。在这种情况下,它发生在证书验证之前:您无法建立SSL连接,verify = False将无济于事。协议错误通常是指未知/过时的SSL密码版本。

您可以尝试在请求中重新安装额外的密码(在Ubuntu 18.04上为我工作,但在OS X上没有)

server <- function(input, output, session) {
    pe<-{
        sts<-c("Rev","Rev")
        sID<-c("123","124")
        snID<-c("23","34")
        name<-c("s","d")
        data.frame(sts,sID,snID,name)
    }


    output$dbs<-renderUI({

        pickerInput("DB", "Select Database/s", 
                    choices = c("name","snID"), 
                    multiple = F,options = list(`actions-box` = TRUE),
                    selected = "name")

    })
    output$fn<-renderPlotly({
        #2.2 MAKING A TABLE for public.exists
        tbl<-table(pe[[input$DB]], pe$sts)

        ggplotly(
            ggplot(as.data.frame(tbl), aes(!!sym(input$DB), Freq, fill = sts)) 
        )

    })

}