GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — python-docs-samples/endpoints/bookstore-grpc at master · fullstackguy/python-docs-samples

Expand file tree

/

bookstore-grpc

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
 
 
/

bookstore-grpc

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
generated_pb2
generated_pb2
 
 
Dockerfile
Dockerfile
 
 
README.md
README.md
 
 
api_config.yaml
api_config.yaml
 
 
api_config_auth.yaml
api_config_auth.yaml
 
 
api_config_http.yaml
api_config_http.yaml
 
 
bookstore.proto
bookstore.proto
 
 
bookstore.py
bookstore.py
 
 
bookstore_client.py
bookstore_client.py
 
 
bookstore_server.py
bookstore_server.py
 
 
http_bookstore.proto
http_bookstore.proto
 
 
jwt_token_gen.py
jwt_token_gen.py
 
 
requirements.txt
requirements.txt
 
 
status.py
status.py
 
 

README.md

Outline

Google Cloud Endpoints Bookstore App in Python

Installing the dependencies using virtualenv:

virtualenv bookstore-env
source bookstore-env/bin/activate

Install all the Python dependencies:

pip install -r requirements.txt

Install the gRPC libraries and tools

Running the Server Locally

To run the server:

python bookstore_server.py

The -h command line flag shows the various settings available.

Running the Client Locally

To run the client:

python bookstore_client.py

As with the server, the -h command line flag shows the various settings available.

Generating a JWT token from a service account file

To run the script:

python jwt_token_gen.py --file=account_file --audiences=audiences --issuer=issuer

The output can be used as "--auth_token" for bookstore_client.py

Regenerating the API stubs

The bookstore gRPC API is defined by bookstore.proto The API client stubs and server interfaces are generated by tools.

To make it easier to get something up and running, we've included the generated code in the sample distribution. To modify the sample or create your own gRPC API definition, you'll need to update the generated code. To do this, once the gRPC libraries and tools are installed, run:

python -m grpc.tools.protoc --python_out=generated_pb2 \
    --grpc_python_out=generated_pb2 --proto_path=. bookstore.proto
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.