Skip to main content

Emulator for Google Cloud Functions to run in local

Project description

Google Cloud Functions Python Emulator

downloads build

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gcp-functions-emulator-0.1.1.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gcp_functions_emulator-0.1.1-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file gcp-functions-emulator-0.1.1.tar.gz.

File metadata

  • Download URL: gcp-functions-emulator-0.1.1.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.0 CPython/3.7.2

File hashes

Hashes for gcp-functions-emulator-0.1.1.tar.gz
Algorithm Hash digest
SHA256 663604c1bea55dc6f4ebeee63dc9598079cd93ebd54ba154bf84aba88834da23
MD5 77f8719c4fbec21cf5aa2590483087fb
BLAKE2b-256 68ded5c2404532f909b6fd21a91f1ec74f7dd76d6fa97ff6275f15771a56a5c9

See more details on using hashes here.

File details

Details for the file gcp_functions_emulator-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: gcp_functions_emulator-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.0 CPython/3.7.2

File hashes

Hashes for gcp_functions_emulator-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 60a976e2e2b107c515e0cda3e3b8c91e68c513f73a1926f0c3730d3edb39f2f7
MD5 a79574237d140953ae3a009824cf9f47
BLAKE2b-256 9b3039b507d708c9ba387d76b93121a8c231b59ad31db480463140c21b2838c1

See more details on using hashes here.

Supported by

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