Welcome to goblet’s documentation!¶
Overview¶
Goblet is a framework for writing serverless rest apis in python in google cloud. It allows you to quickly create and deploy python apis backed by cloudfunctions.
It provides:
A command line tool for creating, deploying, and managing your api
A decorator based API for integrating with GCP API Gateway, Storage, Cloudfunctions, PubSub, Scheduler, and other GCP services.
Local environment for your api endpoints
Dynamically generated openapispec
Support for multiple stages
You can create Rest APIs:
from goblet import Goblet
app = Goblet(function_name="goblet_example")
@app.route('/home')
def home():
return {"hello": "world"}
@app.route('/home/{id}', methods=["POST"], param_types={"name":"integer"})
def post_example(id):
return app.jsonify(id)
Once you’ve written your code, you just run goblet deploy and Goblet takes care of deploying your app.
$ goblet deploy
...
https://api.uc.gateway.dev
$ curl https://api.uc.gateway.dev/home
{"hello": "world"}
Installation¶
To install goblet, open an interactive shell and run:
pip install goblet-gcp
You will also need to install gcloud cli for authentication
Note
Make sure to have the correct services enabled in your gcp project api-gateway, cloudfunctions, storage
Note
Goblet requires python version 3.8 or higher.
Quickstart¶
Topics¶
- Topics
- Routing
- Config
- Private Python Libraries
- Permissions and Service Accounts
- IAM Bindings
- Secrets
- Authentication
- Request
- Response
- OpenApi Spec
- Multiple Files
- Stages
- API Gateway Backends
- Cors
- Multiple Cloudfunctions
- Syncing State
- Middleware
- Labels
- Deploying Arbitrary Services
- Multi Container Deployments
- Error Handling