Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


🎷 simple call & response python to google cloud function

Table of Contents

Cloud Function


πŸ”₯ test out the live deployment of the REST gcloud cloud function!

put in a custom param to see a custom result based on the endpoint tree (such as πŸ—)


# -*- coding: utf8 -*-
def funkyTime(request):
	"""Responds to any HTTP request.
	request (flask.Request): HTTP request object.
	The response text or any set of values that can be turned into a
	Response object using
	`make_response <>`.
	request_json = request.get_json()
	message = None
	if request.args and 'message' in request.args:
		message = request.args.get('message')
	elif request_json and 'message' in request_json:
		message = request_json['message']

	if message == u'πŸ—':
		return "🍝"
	elif message == u'🍝':
		return "πŸ—"
		return "πŸ‘Ž"
  • your google cloud platform console should look like this once completed:

App Engine


πŸ”₯ test out the live deployment of the gcloud flask python app!

  • run python <PARAM> to get a response via python
  • go to to get a response via web browser

put in a custom param to see a custom result based on the endpoint tree (such as πŸ—)


  • modify to change flask endpoints
  • locally run gunicorn -k eventlet -w 1 --bind$(PORT) wsgi to test the flask/socket server
  • run gcloud app deploy to sync your changes with the google app engine you've set up
  • check app engine dashboard to see how the project is faring


  1. setup local Google Cloud Platform Python Development Environment
  • sudo apt install python python-dev python3 python3-dev
  • wget
  • sudo python
  • pip install --upgrade virtualenv
  • virtualenv --python python3 env
  • pip install google-cloud-storage
  1. create new app engine using a Python App Engine Standard Environment
  • new app engine
  • python standard environment
  1. download the Google Cloud SDK and setup the gcloud command
  • wget
  • tar zxvf google-cloud-sdk-223.0.0-linux-x86_64.tar.gz ~/google-cloud-sdk
  • cd ~ && ./google-cloud-sdk/
  1. initialize using gcloud init
  • requires logging into google account and setting up PATH
  1. deploy using gcloud app deploy

  2. enable websocket use by running the following command:

gcloud compute firewall-rules create default-allow-websockets --allow tcp:65080 --target-tags websocket --description "allow websocket traffic on port 65080"

using websockets requires a configured billing account linked to your app engine project. using the basic flask endpoints, however, does not.


julian weiss (insanj). (c) 2018. reach out on github!


funky is licensed under gpl-3.0. see license file.