Facebook Graph API Error Sslerror (1, U ' [ssl:certificate_verify_failed] CERTIFICATE VERIFY FAILED (_ssl.c:661) ')

Source: Internet
Author: User
Tags ssl certificate

Using the Facebook Graph API, the error is as follows

At first, I thought it was the HTTPS certificate failed to check the source code, did not see the problem, so the python27\lib\site-packages\requests\adapters.py file of the following location exception processing comments out, to see where the exception from

    defSend (self, request, Stream=false, Timeout=none, Verify=true, Cert=none, proxies=None):"""sends Preparedrequest object.        Returns Response object.        :p Aram Request:The:class: ' Preparedrequest <PreparedRequest> ' being sent.        :p Aram Stream: (optional) Whether to stream the request content. :p Aram Timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a:ref        : ' (connect timeout, read timeout) <timeouts> ' tuple. : type timeout:float or tuple or urllib3 timeout object:p Aram verify: (optional) either a Boolean, in which case I T controls whether we verify the server ' s TLS certificate, or a string, in which case it must be a P        Ath to a CA bundles to use:p Aram cert: (optional) any user-provided SSL certificate to be trusted.        :p Aram proxies: (optional) The proxies dictionary to apply to the request. : Rtype:requests. Response"""Conn=self.get_connection (Request.url, proxies) self.cert_verify (conn, request.url, verify, cert) URL=Self.request_url (Request, proxies) Self.add_headers (request) chunked= not(Request.body isNoneor 'Content-length' inchrequest.headers)ifisinstance (timeout, tuple):Try: Connect, read=Timeout Timeout= Timeoutsauce (Connect=connect, read=Read)exceptValueError as E:#This may raise a string formatting error.Err = ("Invalid Timeout {0}. Pass A (connect, read)"                       "timeout tuple, or a single float to set"                       "both timeouts to the same value". Format (timeout))RaiseValueError (Err)elifisinstance (Timeout, timeoutsauce):Pass        Else: Timeout= Timeoutsauce (Connect=timeout, read=Timeout)Try:            if  notChunked:resp=Conn.urlopen (Method=request.method, url=URL, Body=Request.body, headers=Request.headers, redirect=False, Assert_same_host=False, Preload_content=False, Decode_content=False, retries=self.max_retries, timeout=Timeout)#Send the request.            Else:                ifHASATTR (Conn,'Proxy_pool'): Conn=Conn.proxy_pool Low_conn= Conn._get_conn (timeout=default_pool_timeout)Try: Low_conn.putrequest (request.method, URL, Skip_accept_encoding=True) forHeader, valueinchRequest.headers.items (): Low_conn.putheader (header, value) low_conn.endhead ERS () forIinchrequest.body:low_conn.send (Hex (len (i)) [2:].encode ('Utf-8')) Low_conn.send (b'\ r \ n') low_conn.send (i) low_conn.send (b'\ r \ n') Low_conn.send (b'0\r\n\r\n')                    #Receive The response from the server                    Try:                        #for Python 2.7+ versions, use buffering of HTTP                        #ResponsesR = Low_conn.getresponse (buffering=True)exceptTypeError:#For compatibility with Python 2.6 versions and backR =low_conn.getresponse () Resp=Httpresponse.from_httplib (R, Pool=Conn, Connection=Low_conn, Preload_content=False, Decode_content=False)except:                    #If We hit any problems here, the connection.                    #Then , reraise So, we can handle the actual exception.low_conn.close ()Raise        except(ProtocolError, Socket.error) as err:RaiseConnectionerror (Err, request=request)exceptMaxretryerror as E:ifisinstance (E.reason, connecttimeouterror):#Todo:remove This in 3.0.0:see #2811                if  notisinstance (E.reason, newconnectionerror):RaiseConnectTimeout (E, request=request)ifisinstance (E.reason, responseerror):RaiseRetryerror (E, request=request)ifisinstance (E.reason, _proxyerror):RaiseProxyerror (E, request=request)RaiseConnectionerror (E, request=request)exceptClosedpoolerror as E:RaiseConnectionerror (E, request=request)except_proxyerror as E:RaiseProxyerror (e)#except (_sslerror, _httperror) as E:       #if Isinstance (E, _sslerror):       #Raise Sslerror (E, request=request)       #elif isinstance (E, readtimeouterror):       #Raise ReadTimeout (E, request=request)       #Else:       #Raise        returnSelf.build_response (Request, RESP)

Error after comment

So I python27\lib\site-packages\urllib3\connectionpool.py625 to 630 lines to comment out

Error

The final estimate is a proxy problem, find a server outside the wall to try it really good, do not FQ will not be done, shit

Wish the early victory of the party president

Facebook Graph API Error Sslerror (1, U ' [ssl:certificate_verify_failed] CERTIFICATE VERIFY FAILED (_ssl.c:661) ')

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.