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 address(name):
"""Get someone's address."""
if name == 'Jane':
return '1 Main Street'
elif name == 'John':
return '2 Alternative Avenue'
else:
return None
You can serve the function address() as a web API with funcportal on the command line:
$ funcportal code:address
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/address',
json={'name': 'Jane'}
)
address = response.json()['result']
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.0.tar.gz
(4.9 kB
view hashes)
Built Distribution
Close
Hashes for funcportal-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f4ff84a77f82c54cb99c3e6bcd6cf94f015f7f25df673a696c0a51539abab92 |
|
MD5 | fbce0a4a88a59e81267553e2e9884ea1 |
|
BLAKE2b-256 | afff0e619199a74b8086d696dfa579ab4575de3f76298a0d9c2eb034481ded64 |