Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fergalwalsh/pico
Pico is a very small web application framework for Python.
https://github.com/fergalwalsh/pico
Last synced: 13 days ago
JSON representation
Pico is a very small web application framework for Python.
- Host: GitHub
- URL: https://github.com/fergalwalsh/pico
- Owner: fergalwalsh
- Created: 2011-07-31T12:04:39.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2020-04-02T13:46:42.000Z (over 4 years ago)
- Last Synced: 2024-09-21T17:58:10.543Z (about 2 months ago)
- Language: Python
- Homepage: http://pico.readthedocs.io/
- Size: 493 KB
- Stars: 186
- Watchers: 17
- Forks: 41
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Install
`pip install --upgrade pico`## Write a Python module:
```python
# 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 sapp = PicoApp()
app.register_module(__name__)```
## Start the server:
`python -m pico.server example`## Call your http api functions from with any http client:
`curl http://localhost:4242/example/hello/?who="fergal"``curl http://localhost:4242/example/goodbye/?who="fergal"`
## Using the Javascript client:
```html
Pico Example
var example = pico.importModule('example')
example.hello("Fergal").then(function(response){
document.getElementById('message').innerHTML = response;
});
```
## Using the Python client:
```python
import pico.clientexample = pico.client.load('http://localhost:4242/example')
example.hello('World')```