Loading repository data…
Loading repository data…
fergalwalsh / repository
Pico is a very small web application framework for Python.
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
pip install --upgrade pico
# example.py
import pico
from pico import PicoApp
@pico.expose()
def hello(who):
s = "hello %s!" % who
return s
@pico.expose()
def goodbye(who):
s = "goodbye %s!" % who
return s
app = PicoApp()
app.register_module(__name__)
python -m pico.server example
curl http://localhost:4242/example/hello/?who="fergal"
curl http://localhost:4242/example/goodbye/?who="fergal"
<!DOCTYPE HTML>
<html>
<head>
<title>Pico Example</title>
<!-- Load the pico Javascript client, always automatically available at /pico.js -->
<script src="/pico.js"></script>
<!-- Load our example module -->
<script src="/example.js"></script>
</head>
<body>
<p id="message"></p>
<script>
var example = pico.importModule('example')
example.hello("Fergal").then(function(response){
document.getElementById('message').innerHTML = response;
});
</script>
</body>
</html>
import pico.client
example = pico.client.load('http://localhost:4242/example')
example.hello('World')