You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<!--TODO(tkarasova) update the link to the tutorials when will be published-->
36
-
If you would like to have a closer look at the Retail API features and try them yourself,
37
-
the best option is to use the [Interactive Tutorials](https://cloud.google.com/retail/docs/overview). The tutorials will be launched in the CloudShell environment, and you will be able to request the Retail services and check the response with minimum time and effort.
41
+
If you would like to have a closer look at the Retail API features and try them
42
+
yourself, the best option is to use the [Interactive
43
+
Tutorials](https://cloud.google.com/retail/docs/overview). The tutorials will be
44
+
launched in the CloudShell environment, and you will be able to request the
45
+
Retail services and check the response with minimum time and effort.
38
46
39
-
The code samples in the directory **python-docs-samples/retail/interactive-tutorials** are explicitly created for use with the Retail Interactive Tutorials.
47
+
The code samples in the directory
48
+
**python-docs-samples/retail/interactive-tutorials** are explicitly created for
49
+
use with the Retail Interactive Tutorials.
40
50
41
-
If, for some reason, you have decided to proceed with these code samples without the tutorial, please go through the following steps and set up the required preconditions.
51
+
If, for some reason, you have decided to proceed with these code samples without
52
+
the tutorial, please go through the following steps and set up the required
53
+
preconditions.
42
54
43
55
### Select your project and enable the Retail API
44
56
45
-
Google Cloud organizes resources into projects. This lets you
46
-
collect all related resources for a single application in one place.
57
+
Google Cloud organizes resources into projects. This lets you collect all
58
+
related resources for a single application in one place.
47
59
48
-
If you don't have a Google Cloud project yet or you're not the owner of an existing one, you can
49
-
[create a new project](https://console.cloud.google.com/projectcreate).
60
+
If you don't have a Google Cloud project yet or you're not the owner of an
After the project is created, set your PROJECT_ID to a ```project``` variable:
52
65
@@ -56,18 +69,23 @@ After the project is created, set your PROJECT_ID to a ```project``` variable:
56
69
gcloud config set project <YOUR_PROJECT_ID>
57
70
```
58
71
59
-
1. Ensure that the Retail API is enabled foryour projectin the [API & Services page](https://console.cloud.google.com/apis/api/retail.googleapis.com/).
72
+
1. Ensure that the Retail API is enabled foryour projectin the [API & Services
To prepare the work environment you should perform the following steps:
78
+
64
79
- Create a service account.
65
-
- Create service account key and set it to authorize your calls to the Retail API.
80
+
- Create service account key and set it to authorize your calls to the Retail
81
+
API.
66
82
- Install Google Cloud Retail library.
67
83
68
84
### Create service account
69
85
70
-
To access the Retail API, you must create a service account. Check that you are an owner of your Google Cloud project on the [IAM page](https://console.cloud.google.com/iam-admin/iam).
86
+
To access the Retail API, you must create a service account. Check that you are
with valid products prepared in the `resources` directory.
137
158
138
-
The other file, python-docs-samples/retail/interactive-tutorials/resources/products_some_invalid.json, contains both valid and invalid products. You will use it to check the error handling.
contains both valid and invalid products. You will use it to check the error
162
+
handling.
139
163
140
164
### Upload catalog data to Cloud Storage
141
165
142
-
In your own project you need to create a Cloud Storage bucket and put the JSON file there.
143
-
The bucket name must be unique. For convenience, you can name it `<YOUR_PROJECT_ID>_<TIMESTAMP>`.
166
+
In your own project you need to create a Cloud Storage bucket and put the JSON
167
+
file there. The bucket name must be unique. For convenience, you can name it
168
+
`<YOUR_PROJECT_ID>_<TIMESTAMP>`.
144
169
145
-
1. The code samples foreach of the Retail services are storedin different directories.
170
+
1. The code samples foreach of the Retail services are storedin different
171
+
directories.
146
172
147
173
Go to the code samples directory, your starting point to run more commands.
148
174
149
175
```bash
150
176
cd python-docs-samples/retail/interactive-tutorials
151
177
```
152
178
153
-
1. To create the bucket and upload the JSON file, open python-docs-samples/retail/interactive-tutorials/product/setup_product/products_create_gcs_bucket.py file
179
+
1. To create the bucket and upload the JSON file, open
Now you can see the bucket is created in the [Cloud Storage](https://console.cloud.google.com/storage/browser), and the files are uploaded.
190
+
Now you can see the bucket is created in the [Cloud
191
+
Storage](https://console.cloud.google.com/storage/browser), and the files
192
+
are uploaded.
162
193
163
194
1. The name of the created Cloud Storage bucket is printed in the Terminal.
164
195
165
-
```
196
+
```bash
166
197
The gcs bucket <YOUR_PROJECT_ID>_<TIMESTAMP> was created
167
198
```
168
199
@@ -174,7 +205,9 @@ The bucket name must be unique. For convenience, you can name it `<YOUR_PROJECT_
174
205
175
206
### Import products to the Retail Catalog
176
207
177
-
To import the prepared products to a catalog, open python-docs-samples/retail/interactive-tutorials/product/import_products_gcs.py file and run the following commandin the Terminal:
208
+
To import the prepared products to a catalog, open
0 commit comments