Skip to content

Commit f963641

Browse files
tetiana-karasovadandhlee
authored andcommitted
docs(samples): remove project_number in interactive-tutorials (#158)
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [ ] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/python-retail/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [ ] Ensure the tests and linter pass - [ ] Code coverage does not decrease (if any source code was changed) - [ ] Appropriate docs were updated (if necessary) Fixes #<issue_number_goes_here> 🦕
1 parent e2c523c commit f963641

12 files changed

+20
-27
lines changed

generated_samples/interactive-tutorials/README.md

+3-7
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,12 @@ To run a code sample from the Cloud Shell, you need to be authenticated using th
7272
export GOOGLE_APPLICATION_CREDENTIALS=~/key.json
7373
```
7474

75-
### Set the GOOGLE_CLOUD_PROJECT_NUMBER and GOOGLE_CLOUD_PROJECT environment variables
75+
### Set the GOOGLE_CLOUD_PROJECT environment variable
7676

77-
You will run the code samples in your own Google Cloud project. To use the **project_number** and **project_id** in every request to the Retail API, you should first specify them as environment variables.
77+
You will run the code samples in your own Google Cloud project. To use the **project_id** in every request to the Retail API, you should first specify them as environment variables.
7878

79-
1. Find the project number and project ID in the Project Info card displayed on **Home/Dashboard**.
79+
1. Find the project ID in the Project Info card displayed on **Home/Dashboard**.
8080

81-
1. Set the **project_number** with the following command:
82-
```bash
83-
export GOOGLE_CLOUD_PROJECT_NUMBER=<YOUR_PROJECT_NUMBER>
84-
```
8581
1. Set the **project_id** with the following command:
8682
```bash
8783
export GOOGLE_CLOUD_PROJECT=<YOUR_PROJECT_ID>

generated_samples/interactive-tutorials/TEST_RESOURCES_SETUP_CLEANUP.md

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
## Required environment variables
44

55
To successfully import the catalog data for tests, the following environment variables should be set:
6-
- GOOGLE_CLOUD_PROJECT_NUMBER
76
- GOOGLE_CLOUD_PROJECT
87
- BUCKET_NAME
98
- EVENTS_BUCKET_NAME

generated_samples/interactive-tutorials/product/import_products_inline_source.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
)
3333
from google.protobuf.field_mask_pb2 import FieldMask
3434

35-
# Read the project number from the environment variable
35+
# Read the project ID from the environment variable
3636
project_id = os.environ["GOOGLE_CLOUD_PROJECT"]
3737

3838
default_catalog = f"projects/{project_id}/locations/global/catalogs/default_catalog/branches/default_branch"

generated_samples/interactive-tutorials/search/search_simple_query.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919

2020
from google.cloud.retail import SearchRequest, SearchServiceClient
2121

22-
project_number = os.environ["GOOGLE_CLOUD_PROJECT_NUMBER"]
22+
project_id = os.environ["GOOGLE_CLOUD_PROJECT"]
2323

2424

2525
# get search service request:
2626
def get_search_request(query: str):
2727
default_search_placement = (
2828
"projects/"
29-
+ project_number
29+
+ project_id
3030
+ "/locations/global/catalogs/default_catalog/placements/default_search"
3131
)
3232

generated_samples/interactive-tutorials/search/search_with_boost_spec.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020

2121
from google.cloud.retail import SearchRequest, SearchServiceClient
2222

23-
project_number = os.environ["GOOGLE_CLOUD_PROJECT_NUMBER"]
23+
project_id = os.environ["GOOGLE_CLOUD_PROJECT"]
2424

2525

2626
# get search service request:
2727
def get_search_request(query: str, condition: str, boost_strength: float):
2828
default_search_placement = (
2929
"projects/"
30-
+ project_number
30+
+ project_id
3131
+ "/locations/global/catalogs/default_catalog/placements/default_search"
3232
)
3333

generated_samples/interactive-tutorials/search/search_with_facet_spec.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818

1919
from google.cloud.retail import SearchRequest, SearchServiceClient
2020

21-
project_number = os.environ["GOOGLE_CLOUD_PROJECT_NUMBER"]
21+
project_id = os.environ["GOOGLE_CLOUD_PROJECT"]
2222

2323

2424
# get search service request:
2525
def get_search_request(query: str, facet_key_param: str):
2626
default_search_placement = (
2727
"projects/"
28-
+ project_number
28+
+ project_id
2929
+ "/locations/global/catalogs/default_catalog/placements/default_search"
3030
)
3131
# PUT THE INTERVALS HERE:

generated_samples/interactive-tutorials/search/search_with_filtering.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919

2020
from google.cloud.retail import SearchRequest, SearchServiceClient
2121

22-
project_number = os.environ["GOOGLE_CLOUD_PROJECT_NUMBER"]
22+
project_id = os.environ["GOOGLE_CLOUD_PROJECT"]
2323

2424

2525
# get search service request:
2626
def get_search_request(query: str, _filter: str):
2727
default_search_placement = (
2828
"projects/"
29-
+ project_number
29+
+ project_id
3030
+ "/locations/global/catalogs/default_catalog/placements/default_search"
3131
)
3232

generated_samples/interactive-tutorials/search/search_with_ordering.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919

2020
from google.cloud.retail import SearchRequest, SearchServiceClient
2121

22-
project_number = os.environ["GOOGLE_CLOUD_PROJECT_NUMBER"]
22+
project_id = os.environ["GOOGLE_CLOUD_PROJECT"]
2323

2424

2525
# get search service request:
2626
def get_search_request(query: str, order: str):
2727
default_search_placement = (
2828
"projects/"
29-
+ project_number
29+
+ project_id
3030
+ "/locations/global/catalogs/default_catalog/placements/default_search"
3131
)
3232

generated_samples/interactive-tutorials/search/search_with_pagination.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121

2222
from google.cloud.retail import SearchRequest, SearchServiceClient
2323

24-
project_number = os.environ["GOOGLE_CLOUD_PROJECT_NUMBER"]
24+
project_id = os.environ["GOOGLE_CLOUD_PROJECT"]
2525

2626

2727
# get search service request:
2828
def get_search_request(query: str, page_size: int, offset: int, next_page_token: str):
2929
default_search_placement = (
3030
"projects/"
31-
+ project_number
31+
+ project_id
3232
+ "/locations/global/catalogs/default_catalog/placements/default_search"
3333
)
3434

generated_samples/interactive-tutorials/search/search_with_query_expansion_spec.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
from google.cloud.retail import SearchRequest, SearchServiceClient
2222

23-
project_number = os.environ["GOOGLE_CLOUD_PROJECT_NUMBER"]
23+
project_id = os.environ["GOOGLE_CLOUD_PROJECT"]
2424

2525

2626
# get search service request:
@@ -29,7 +29,7 @@ def get_search_request(
2929
):
3030
default_search_placement = (
3131
"projects/"
32-
+ project_number
32+
+ project_id
3333
+ "/locations/global/catalogs/default_catalog/placements/default_search"
3434
)
3535

generated_samples/interactive-tutorials/test_resources_recovery/create_test_resources.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
from google.cloud.retail import ProductServiceClient
2525
from google.cloud.storage.bucket import Bucket
2626

27-
project_number = os.environ["GOOGLE_CLOUD_PROJECT_NUMBER"]
2827
products_bucket_name = os.environ['BUCKET_NAME']
2928
events_bucket_name = os.environ['EVENTS_BUCKET_NAME']
3029
project_id = os.environ["GOOGLE_CLOUD_PROJECT"]
@@ -40,7 +39,7 @@
4039
events_schema = "../resources/events_schema.json"
4140

4241
object_name = re.search('resources/(.*?)$', product_resource_file).group(1)
43-
default_catalog = f"projects/{project_number}/locations/global/catalogs/default_catalog/branches/default_branch"
42+
default_catalog = f"projects/{project_id}/locations/global/catalogs/default_catalog/branches/default_branch"
4443

4544
storage_client = storage.Client()
4645

generated_samples/interactive-tutorials/test_resources_recovery/remove_test_resources.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,14 @@
2323
from google.cloud.storage.bucket import Bucket
2424

2525

26-
project_number = os.environ["GOOGLE_CLOUD_PROJECT_NUMBER"]
2726
project_id = os.environ["GOOGLE_CLOUD_PROJECT"]
2827
product_bucket_name = os.environ['BUCKET_NAME']
2928
events_bucket_name = os.environ['EVENTS_BUCKET_NAME']
3029

3130
product_dataset = "products"
3231
events_dataset = "user_events"
3332

34-
default_catalog = f"projects/{project_number}/locations/global/catalogs/default_catalog/branches/default_branch"
33+
default_catalog = f"projects/{project_id}/locations/global/catalogs/default_catalog/branches/default_branch"
3534

3635
storage_client = storage.Client()
3736

0 commit comments

Comments
 (0)