Skip to main content

Various Helper Tools to make working with azure functions easier

Project description

FuncTown

FuncTown is a python library to make working with azure functions easier and remove boilerplate.

Getting Started

pip install functown

After installing you can easily get your functions error checked (with an auto-response for execptions triggered):

from functown import handle_errors

@handle_errors(debug=True)
def main(req: func.HttpRequest) -> func.HttpResponse:
    logging.info('Python HTTP trigger function processed a request.')

    # ...

    return func.HttpResponse("success", status_code=200)

Should an exception happening in the middle, the decorator will auto-parse it (and write to logs if debug is true), then provide a response.

You can also parse JWT tokens and validate them (this currently requires to set the B2C_ISSUER_URL and B2C_APP_ID environment variables):

from functown.auth import verify_user

def main(req: func.HttpRequest) -> func.HttpResponse:
    user, user_id, user_scp, local = verify_user(req, scope=scopes.SCOPE_WRITE)

Finally the library also allows you to easily parse arguments coming from the HttpRequest:

from functown import RequestArgHandler

def main(req: func.HttpRequest) -> func.HttpResponse:
    args = RequestArgHandler(req)
    data = args.get_body_query("data_name", required=True, allowed=["foo", "bar"])
    switch = args.get_body("bool_name", map_fct='bool')
    file = args.get_file('file_name', required=True)

All this should remove boilerplate from Azure-Functions.

🎷 Welcome to FuncTown! 🎷

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

functown-0.1.2.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

functown-0.1.2-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file functown-0.1.2.tar.gz.

File metadata

  • Download URL: functown-0.1.2.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for functown-0.1.2.tar.gz
Algorithm Hash digest
SHA256 5dd5bc1fb4a9765d34c89bd96f416ca28b5dd6a39f8f3d8f6196ee71f0140e72
MD5 e2abf8d3ba096ffa73d2bd56f8c5208b
BLAKE2b-256 b9b5a3e828aa007d0e6a45a8efe6e123188a407b2c77943c1aa3b991c4b32a59

See more details on using hashes here.

File details

Details for the file functown-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: functown-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for functown-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7b28271c7954c7e79342e5cff60042d03c732a9fdf51bd931b7e322d91cb2276
MD5 14356d253f1b65c86807ca2d0cbeca03
BLAKE2b-256 2feddbe4f3c3f9205254780926fbf3ecc1cf84753ed3b70827f45a7150d5c2da

See more details on using hashes here.

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