Emulator for Google Cloud Functions to run in local
Project description
This module tries to emulate the environment in Google Cloud Functions for Python. It serves the given function on the given module.
For example. lets imagine we have the following cloud function
# mycloudfunction.py
def api(request):
return 'important data'
To emulate we have to call it like so:
$ gcpfemu <path/to/file.py> <function_name>
For example, with the code above we will call it:
$ gcpfemu mycloudfunction.py api
And to access the data we can use for example curl:
$ curl localhost:5000/api
important data
If you want to run the emulator programatically you can do drun the server from a terminal, you have to disable the debug. It is disabled by default thoug. Flask looks for file changes, but in interactive terminal there's no file.
from gcpfemu import http
port = 1234 # use a different port
module_path = 'mycloudfunction.py' # set the path to the code itself
function_name = 'api' # set the function name
http(module_path, function_name, port, debug) # load and serve the function
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for gcp-functions-emulator-0.0.16.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 05adf02c5218699236f2fffcf794ff43e12e77c485c1783b3250ed6dcdcedfb7 |
|
MD5 | 6ea78f53744fbb8dd8124408244b5569 |
|
BLAKE2b-256 | 6662cb72231de1f5f23938e2db5cc276c244a950526f5a50c3fd3aa2ed644b9d |
Close
Hashes for gcp_functions_emulator-0.0.16-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3595ce8b99333c4ba999a41750c138f06061e75ac3a6f7714b81e33c9e2aac18 |
|
MD5 | 7f00bcdf6641a1c0af6e685415af6244 |
|
BLAKE2b-256 | 351e7eea1253e080cf2d7a01608a19d3f0e1808ed675725cd9760f1d89137371 |