Giter Site home page Giter Site logo

micropython-https-server's Introduction

Micropython-https-server

This is some example code thrown together to demonstrate how to implement a very simple https web server. I needed one for a project and could not get a working example from one place. Instead I had to figure out the details from a couple of examples, questions in forums and other sources of information.

So this is my example implementation. It's not a framework, but code you can take and modify to fit your needs. The whole code is in HTTPSServer.py, it requires a certificate and matching key file to run. Also included in this repository is everything else to set things up, if your platform is an ESP32 running Micropython. If you have ampy installed, the included shellscript update.sh should configure and upload everything required. main.py includes some convenience functions and also sets up networking. It should get autoloaded by Micropython upon startup. The https server needs to be started up by hand though, to make sure you can get a foot in the door. Remember: example, not framework.

The web server code includes support for delivering a favicon.ico (if the file is found on the device), and a very lame implementation of authorization. The http request header is nicely wrapped in a dictionary for easy access. But this code does not include any kind of support for handling forms, neither for GET nor for POST requests.

Python and myself will never become friends, so this code might not be elegant, but at least it was working on my ESP32 NodeMCU using Micropython 1.18 when I wrote it. It was only put here to save other from the pain, I experienced trying to get this done. While I don't plan on writing any updates to this code, pull requests will be processed.

Hope this helps you as it would have helped me,
SvOlli

P.S.: Python is the BASIC of the 21st century.

micropython-https-server's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.