This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import time | |
class ServeFile: | |
def __init__(self, app, path="", webpath=""): | |
self._app = app | |
self._path = path | |
self._webpath = webpath | |
# Common MIME types from https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HTTPRequest: | |
def __init__(self, method="", path="", req_bytearray=None): | |
if req_bytearray is None: | |
self.method = method | |
self.path = path | |
else: | |
# Parse request data from byte array | |
lines = req_bytearray.decode("utf8").split('\r\n') | |
request = lines[0].split(' ') | |
self.method = request[0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import struct | |
import time | |
import board | |
import canio | |
import digitalio | |
# Create a node on a CAN network | |
# Uses the 29-bit extended message ID which contains both a node ID and topic ID | |
# Node ID is the source when sending from a node and destination when sending from the controller to a node |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import storage | |
import adafruit_requests as requests | |
import networkInit # Board specific network connection | |
try: | |
from secrets import secrets | |
connectionString = secrets["ota_connection_string"] | |
except (ImportError, KeyError): | |
print("Connection string is kept in secrets.py, please add it there!") |