Page 2 of 3

Re: picoweb - Web micro (well, pico) framework

Posted: Sun Aug 27, 2017 6:45 am
by pfalcon
Some time ago, picoweb was made to run on ESP8266 (or low-heap ports in general): viewtopic.php?f=16&t=2966#p20150

Question about using Keep-Alive

Posted: Wed Oct 11, 2017 5:24 am
by bitninja
Is there any way to inject the ETAG/Keep-Alive values into the response headers for specific responses?

I am trying to take advantage of the client caching of things like javascript and stylesheet files so that they are not reloaded every time a page is rendered. As it is, I can see them requested over and over again, which is really a waste.

Thanks.

Edit: OK, perhaps I meant using the Cache-Control : max-age construct in the HTTP header returned by the "server".

Image

Re: picoweb - Web micro (well, pico) framework

Posted: Sat Oct 28, 2017 4:13 pm
by pfalcon
Sure, if you look at the picoweb examples, you'll see one which constructs a full HTTP reply, e.g. https://github.com/pfalcon/picoweb/blob ... app.py#L12 . So of course, you can add any headers you like.

Re: picoweb - Web micro (well, pico) framework

Posted: Thu Nov 16, 2017 4:25 am
by bitninja
Thanks for pointing that out. Not very helpful for what I need. But thanks.

I am using the sendfile() function and it already uses the standard header...

Code: Select all

# handle the root URL
def index(req, resp):
    yield from app.sendfile(resp, rootdir + "index.html")

# handle all other resource (file) requests
def file(req, resp):
    fname = req.url_match.group(1)
    yield from app.sendfile(resp, rootdir + fname)
as shown here https://github.com/pfalcon/picoweb/blob ... __.py#L245

Being new to Python, what is my best option for injecting these headers when I use sendfile() and just want to return a file?

Thanks.

Re: picoweb - Web micro (well, pico) framework

Posted: Sat Dec 16, 2017 10:40 am
by pfalcon
1.3 was released: https://pypi.python.org/pypi/picoweb/1.3 . There's a backward incompatible change: https://github.com/pfalcon/picoweb/issues/21

Re: picoweb - Web micro (well, pico) framework

Posted: Sun Jan 14, 2018 11:01 am
by pfalcon
1.3.1 was released: https://pypi.python.org/pypi/picoweb/1.3.1 .

It's now possible to add arbitrary headers to a reply: https://github.com/pfalcon/picoweb/blob ... t__.py#L39

Re: picoweb - Web micro (well, pico) framework

Posted: Sat Jan 27, 2018 11:10 am
by pfalcon
micropython-lib, uasyncio, and picoweb keep evolving, and some not fully finished ports are starting to have issues due to missing functionality, e.g. https://github.com/pfalcon/picoweb/issues/31 . As mentioned in viewtopic.php?f=15&t=85&start=80#p24415, latest uasyncio, etc. require my fork of MicroPython https://github.com/pfalcon/micropython . More optimizations and new functionality are planned in the future beyond the mainline (which is as of now wasn't updated in a month).

Re: picoweb - Web micro (well, pico) framework

Posted: Tue Jan 30, 2018 9:19 am
by pfalcon
An example of using extra headers in response was contributed: https://github.com/pfalcon/picoweb/blob ... headers.py . Shows serving gzip'ed content, cache control, etc.

Re: picoweb - Web micro (well, pico) framework

Posted: Sat Feb 24, 2018 8:54 pm
by pfalcon
picoweb 1.4 was released: https://pypi.python.org/pypi/picoweb/1.4 . It allows to disable log output or configure it more flexibly using "logging" module. More info: https://github.com/pfalcon/picoweb/comm ... 59740aab01 , https://github.com/pfalcon/picoweb/comm ... 1f0a92a200

Re: picoweb - Web micro (well, pico) framework (with webserver, etc.)

Posted: Thu Nov 22, 2018 5:08 am
by pfalcon
picoweb 1.5.1 was released: https://pypi.org/project/picoweb/1.5.1/ . It optimizes form handling a bit (and provides an form handling example, as that wasn't available previously), but makes small backward-incompatible change in that regard. The change and motivation are described in https://github.com/pfalcon/picoweb/comm ... 7e1a969112 (it's memory usage optimization, no surprise here).