Skip to content
This repository was archived by the owner on Oct 29, 2018. It is now read-only.

Files

Latest commit

Daniel Spindelbauergitbook-bot
Daniel Spindelbauer
and
Aug 15, 2018
78cc91b · Aug 15, 2018

History

History
28 lines (19 loc) · 748 Bytes

File metadata and controls

28 lines (19 loc) · 748 Bytes

HTTPS

Basic connection using ssl.wrap_socket().

import socket
import ssl

s = socket.socket()
ss = ssl.wrap_socket(s)
ss.connect(socket.getaddrinfo('www.google.com', 443)[0][-1])

Below is an example using certificates with the blynk cloud.

Certificate was downloaded from the blynk examples folder and placed in /flash/cert/ on the device.

import socket
import ssl

s = socket.socket()
ss = ssl.wrap_socket(s, cert_reqs=ssl.CERT_REQUIRED, ca_certs='/flash/cert/ca.pem')
ss.connect(socket.getaddrinfo('cloud.blynk.cc', 8441)[0][-1])

For more info, check the ssl module in the API reference.