Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ transport is well-supported.
Now let's test the server out locally. First, we install dependencies.

```bash
virtualenv venv -p python3
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
```
Expand Down Expand Up @@ -169,7 +169,7 @@ the `gcr.io` container registry, so we'll tag it accordingly.

```bash
export GCP_PROJECT=<Your GCP Project Name>
docker build -t gcr.io/$GCP_PROJECT/grpc-calculator:latest
docker build -t gcr.io/$GCP_PROJECT/grpc-calculator:latest .
```

The tag above will change based on your GCP project name. We're calling the
Expand Down Expand Up @@ -251,3 +251,20 @@ grpcurl \
```

And now you've got an auto-scaling calculator gRPC service!

To send a request with authentication enabled for Cloud Run, type this command
from an environment where you have a service account enabled

```bash
TOKEN=`gcloud auth print-identity-token --audiences https://${ENDPOINT}`
```

Then add the token to the request with the command

```bash
grpcurl -H "Authorization: Bearer $TOKEN" \
-proto calculator.proto \
-d '{"first_operand": 2.0, "second_operand": 3.0, "operation": "ADD"}' \
${ENDPOINT}:443 \
Calculator.Calculate
```