Serve Python functions as web APIs
Project description
funcportal runs your Python functions as a web API, with no code changes required.
Usage
Given a Python module like code.py below:
# code.py
def hello(name):
return f'Hello, {name}!'
You can serve the function hello() as a web API with funcportal on the command line:
$ funcportal code:hello
and you can then make HTTP POST requests to it, for example with the Python requests library:
>>> import requests
>>> response = requests.post(
>>> 'http://localhost:5000/hello',
>>> json={'name': 'Jane'}
>>> )
>>> result = response.json()['result']
>>> print(result)
Hello, Jane!
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
funcportal-0.1.1.tar.gz
(5.1 kB
view hashes)
Built Distribution
Close
Hashes for funcportal-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2c5ca83081659fdd1eb2cd80a7c5fd33248558108051b052cd81c5f19cebf27 |
|
MD5 | 3729745236dc35c79895a63297f790ed |
|
BLAKE2b-256 | 5c832dab395687e5ae727233f0406b3255717310864dad6f8c71fb3ff0ea9b31 |