简体   繁体   中英

SSLError while requesting my API with Flask

I developped an API (endpoint : https://helloworld.mycompanyname that I need to request with a parameter 'key' ). I want to access this API from my front so I'm trying this method :

@app.route('/test/', methods=("POST","GET"))
def test():
   payload = {'key':'****'}
   r = requests.get('https://helloworld.mycompanyname/', params=payload)  
   return r.text

And I have this SSLerror :

requests.exceptions.SSLError: HTTPSConnectionPool(host='helloworld.mycompanyname', port=443): Max retries exceeded with url: /?key=*** (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])")))

How can I fix that ?

Which version of python are you using ? If you are using the older version then you end up getting SSL Error try to upgrade to 3.4 or latest. It should resolve your issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM