Skip to main content

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)

Uploaded Source

Built Distribution

funcportal-0.1.0-py3-none-any.whl (6.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page