Files
pycom-documentation/content/tutorials/networkprotecols/https.md
gijsio 9a0602f9e5 Restructure, rev1
* Products
    -> updated with new products
    -> added accessories
* Getting started
   -> re-structured getting started guide
   -> removed some of the advanced stuff
* Tutorials / Examples
   -> added categories
   -> added new basic tutorials Sleep, GPIO and Pring
   -> added WiFi ap / sta tutorial
   -> added wifi Scan MAC tutorial
* Firmware API
   -> added pysense pytrack pygate categories here
* Datasheets
   -> added CE FCC and RoHS documents
   -> added pysense2 and pytrack 2 templates
* Update firmware
   -> new section, added all methods of updating the firmware
* License
   -> put license in its own section

general remarks:
-> updated the layout / theme
   no more red code text
   codeblocks actually work now
-> general layout updates, removed the old html structures (mostly)
2020-07-09 12:57:44 +02:00

34 lines
842 B
Markdown

---
title: "HTTPS"
aliases:
- tutorials/all/https.html
- tutorials/all/https.md
- chapter/tutorials/all/https
---
Basic connection using `ssl.wrap_socket()`.
```python
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](https://github.com/wipy/wipy/tree/master/examples/blynk) and placed in `/flash/cert/` on the device.
```python
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`](/firmwareapi/micropython/ussl) module in the API reference.