Giter Site home page Giter Site logo

project20180407's Introduction

Endpoints Frameworks v2 Python Sample

Open in Cloud Shell

This demonstrates how to use Google Cloud Endpoints Frameworks v2 on Google App Engine Standard Environment using Python.

Setup

Create a lib directory in which to install the Endpoints Frameworks v2 library. For more info, see Installing a library.

Install the Endpoints Frameworks v2 library:

$ pip install -t lib -r requirements.txt

Deploying to Google App Engine

Generate an OpenAPI file by running: python lib/endpoints/endpointscfg.py get_openapi_spec main.EchoApi --hostname [YOUR-PROJECT-ID].appspot.com

Remember to replace [YOUR-PROJECT-ID] with your project ID.

To set up OAuth2, replace your-oauth-client-id.com under audiences in the annotation for get_user_email with your OAuth2 client ID. If you want to use Google OAuth2 Playground, use 407408718192.apps.googleusercontent.com as your audience. To generate a JWT, go to the following address: https://developers.google.com/oauthplayground.

Deploy the generated service spec to Google Cloud Service Management: gcloud endpoints services deploy echov1openapi.json

The command returns several lines of information, including a line similar to the following:

Service Configuration [2016-08-01r0] uploaded for service "[YOUR-PROJECT-ID].appspot.com"

Open the app.yaml file and in the env_variables section, replace [YOUR-PROJECT-ID] in [YOUR-PROJECT-ID].appspot.com with your project ID. This is your Endpoints service name. Then replace 2016-08-01r0 with your uploaded service management configuration.

Then, deploy the sample using gcloud:

$ gcloud app deploy

Once deployed, you can access the application at https://your-service.appspot.com

project20180407's People

Contributors

tangtianqin avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.