Skip to main content

A simple and lightweight MicroPython web-framework

Project description

argent

Argent is a simple and lightweight web-framework for MicroPython.

TODO:

  • beautify pyproject.toml
  • ✅ add post and put methods
  • add custom http_headers option
  • create docs
  • add favicon.ico support
  • ✅ create API root, with all url's

Example:

import argent, socket

@argent.route("/hello/world")
def hello_world(request):
    return(200, {}, "Hello from Argent framework!")

# connect to wi-fi

# create socket
addr = socket.getaddrinfo('0.0.0.0', 80)[0][-1]

s = socket.socket()
s.bind(addr)
s.listen(1)

# run argent client
while True:
    argent.listen(socket)

DOCS:

Sample url_linker:

{'route': '/hello/world', 'function': <function hello_world at 0x2000bf00>}
{'route': '/api', 'function': <function hello_world at 0x2000c0f0>}
{'route': '/controll/pico', 'function': <function hello_world at 0x2000c170>}
{'route': '/weather', 'function': <function hello_world at 0x2000c1f0>}
{'route': '/controll/esp8266', 'function': <function hello_world at 0x2000c270>}

Errors (TODO):

Traceback (most recent call last):
  File "<stdin>", line 65, in <module>
  File "argent.py", line 95, in listen
  File "argent.py", line 8, in __get_route
IndexError: list index out of range

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gerent-0.0.1.tar.gz (3.8 kB view hashes)

Uploaded Source

Built Distribution

gerent-0.0.1-py3-none-any.whl (4.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page