google-cloud-recommender 2.18.0__tar.gz → 2.18.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- google_cloud_recommender-2.18.2/MANIFEST.in +20 -0
- {google_cloud_recommender-2.18.0/google_cloud_recommender.egg-info → google_cloud_recommender-2.18.2}/PKG-INFO +107 -7
- google_cloud_recommender-2.18.2/README.rst +197 -0
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google/cloud/recommender/__init__.py +1 -1
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google/cloud/recommender/gapic_version.py +2 -2
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google/cloud/recommender_v1/__init__.py +1 -1
- {google_cloud_recommender-2.18.0/google/cloud/recommender_v1beta1 → google_cloud_recommender-2.18.2/google/cloud/recommender_v1}/gapic_version.py +2 -2
- {google_cloud_recommender-2.18.0/google/cloud/recommender_v1beta1 → google_cloud_recommender-2.18.2/google/cloud/recommender_v1}/services/__init__.py +1 -1
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google/cloud/recommender_v1/services/recommender/__init__.py +1 -1
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google/cloud/recommender_v1/services/recommender/async_client.py +53 -13
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google/cloud/recommender_v1/services/recommender/client.py +52 -13
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google/cloud/recommender_v1/services/recommender/pagers.py +1 -1
- {google_cloud_recommender-2.18.0/google/cloud/recommender_v1beta1 → google_cloud_recommender-2.18.2/google/cloud/recommender_v1}/services/recommender/transports/__init__.py +1 -1
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google/cloud/recommender_v1/services/recommender/transports/base.py +5 -1
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google/cloud/recommender_v1/services/recommender/transports/grpc.py +2 -3
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google/cloud/recommender_v1/services/recommender/transports/grpc_asyncio.py +1 -1
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google/cloud/recommender_v1/services/recommender/transports/rest.py +5 -1
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google/cloud/recommender_v1/services/recommender/transports/rest_base.py +1 -1
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google/cloud/recommender_v1/types/__init__.py +1 -1
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google/cloud/recommender_v1/types/insight.py +1 -1
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google/cloud/recommender_v1/types/insight_type_config.py +1 -1
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google/cloud/recommender_v1/types/recommendation.py +1 -1
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google/cloud/recommender_v1/types/recommender_config.py +1 -1
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google/cloud/recommender_v1/types/recommender_service.py +1 -1
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google/cloud/recommender_v1beta1/__init__.py +1 -1
- {google_cloud_recommender-2.18.0/google/cloud/recommender_v1 → google_cloud_recommender-2.18.2/google/cloud/recommender_v1beta1}/gapic_version.py +2 -2
- {google_cloud_recommender-2.18.0/tests → google_cloud_recommender-2.18.2/google/cloud/recommender_v1beta1/services}/__init__.py +1 -1
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google/cloud/recommender_v1beta1/services/recommender/__init__.py +1 -1
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google/cloud/recommender_v1beta1/services/recommender/async_client.py +53 -13
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google/cloud/recommender_v1beta1/services/recommender/client.py +52 -13
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google/cloud/recommender_v1beta1/services/recommender/pagers.py +1 -1
- {google_cloud_recommender-2.18.0/google/cloud/recommender_v1 → google_cloud_recommender-2.18.2/google/cloud/recommender_v1beta1}/services/recommender/transports/__init__.py +1 -1
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google/cloud/recommender_v1beta1/services/recommender/transports/base.py +5 -1
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google/cloud/recommender_v1beta1/services/recommender/transports/grpc.py +2 -3
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google/cloud/recommender_v1beta1/services/recommender/transports/grpc_asyncio.py +1 -1
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google/cloud/recommender_v1beta1/services/recommender/transports/rest.py +5 -1
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google/cloud/recommender_v1beta1/services/recommender/transports/rest_base.py +1 -1
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google/cloud/recommender_v1beta1/types/__init__.py +1 -1
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google/cloud/recommender_v1beta1/types/insight.py +1 -1
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google/cloud/recommender_v1beta1/types/insight_type_config.py +1 -1
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google/cloud/recommender_v1beta1/types/recommendation.py +1 -1
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google/cloud/recommender_v1beta1/types/recommender_config.py +1 -1
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google/cloud/recommender_v1beta1/types/recommender_service.py +1 -1
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2/google_cloud_recommender.egg-info}/PKG-INFO +107 -7
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google_cloud_recommender.egg-info/SOURCES.txt +0 -1
- google_cloud_recommender-2.18.2/google_cloud_recommender.egg-info/requires.txt +7 -0
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/setup.cfg +0 -3
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/setup.py +6 -6
- {google_cloud_recommender-2.18.0/tests/unit → google_cloud_recommender-2.18.2/tests}/__init__.py +1 -1
- {google_cloud_recommender-2.18.0/google/cloud/recommender_v1/services → google_cloud_recommender-2.18.2/tests/unit}/__init__.py +1 -1
- google_cloud_recommender-2.18.2/tests/unit/gapic/__init__.py +15 -0
- google_cloud_recommender-2.18.2/tests/unit/gapic/recommender_v1/__init__.py +15 -0
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/tests/unit/gapic/recommender_v1/test_recommender.py +1 -1
- google_cloud_recommender-2.18.2/tests/unit/gapic/recommender_v1beta1/__init__.py +15 -0
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/tests/unit/gapic/recommender_v1beta1/test_recommender.py +1 -1
- google_cloud_recommender-2.18.0/MANIFEST.in +0 -25
- google_cloud_recommender-2.18.0/README.rst +0 -108
- google_cloud_recommender-2.18.0/google_cloud_recommender.egg-info/requires.txt +0 -7
- google_cloud_recommender-2.18.0/tests/unit/gapic/__init__.py +0 -15
- google_cloud_recommender-2.18.0/tests/unit/gapic/recommender_v1/__init__.py +0 -15
- google_cloud_recommender-2.18.0/tests/unit/gapic/recommender_v1beta1/__init__.py +0 -15
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/LICENSE +0 -0
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google/cloud/recommender/py.typed +0 -0
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google/cloud/recommender_v1/gapic_metadata.json +0 -0
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google/cloud/recommender_v1/py.typed +0 -0
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google/cloud/recommender_v1beta1/gapic_metadata.json +0 -0
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google/cloud/recommender_v1beta1/py.typed +0 -0
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google_cloud_recommender.egg-info/dependency_links.txt +0 -0
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google_cloud_recommender.egg-info/not-zip-safe +0 -0
- {google_cloud_recommender-2.18.0 → google_cloud_recommender-2.18.2}/google_cloud_recommender.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Copyright 2025 Google LLC
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
#
|
|
16
|
+
include README.rst LICENSE
|
|
17
|
+
recursive-include google *.py *.pyi *.json *.proto py.typed
|
|
18
|
+
recursive-include tests *
|
|
19
|
+
global-exclude *.py[co]
|
|
20
|
+
global-exclude __pycache__
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: google-cloud-recommender
|
|
3
|
-
Version: 2.18.
|
|
3
|
+
Version: 2.18.2
|
|
4
4
|
Summary: Google Cloud Recommender API client library
|
|
5
5
|
Home-page: https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-recommender
|
|
6
6
|
Author: Google LLC
|
|
@@ -23,11 +23,22 @@ Classifier: Operating System :: OS Independent
|
|
|
23
23
|
Classifier: Topic :: Internet
|
|
24
24
|
Requires-Python: >=3.7
|
|
25
25
|
License-File: LICENSE
|
|
26
|
-
Requires-Dist: google-api-core[grpc]!=2.0.*,!=2.1.*,!=2.10.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,<3.0.
|
|
27
|
-
Requires-Dist: google-auth!=2.24.0,!=2.25.0,<3.0.
|
|
28
|
-
Requires-Dist: proto-plus<2.0.
|
|
29
|
-
Requires-Dist: proto-plus<2.0.
|
|
30
|
-
Requires-Dist: protobuf!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<
|
|
26
|
+
Requires-Dist: google-api-core[grpc]!=2.0.*,!=2.1.*,!=2.10.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,<3.0.0,>=1.34.1
|
|
27
|
+
Requires-Dist: google-auth!=2.24.0,!=2.25.0,<3.0.0,>=2.14.1
|
|
28
|
+
Requires-Dist: proto-plus<2.0.0,>=1.22.3
|
|
29
|
+
Requires-Dist: proto-plus<2.0.0,>=1.25.0; python_version >= "3.13"
|
|
30
|
+
Requires-Dist: protobuf!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<7.0.0,>=3.20.2
|
|
31
|
+
Dynamic: author
|
|
32
|
+
Dynamic: author-email
|
|
33
|
+
Dynamic: classifier
|
|
34
|
+
Dynamic: description
|
|
35
|
+
Dynamic: home-page
|
|
36
|
+
Dynamic: license
|
|
37
|
+
Dynamic: license-file
|
|
38
|
+
Dynamic: platform
|
|
39
|
+
Dynamic: requires-dist
|
|
40
|
+
Dynamic: requires-python
|
|
41
|
+
Dynamic: summary
|
|
31
42
|
|
|
32
43
|
Python Client for Cloud Recommender
|
|
33
44
|
===================================
|
|
@@ -137,3 +148,92 @@ Next Steps
|
|
|
137
148
|
|
|
138
149
|
.. _Cloud Recommender Product documentation: https://cloud.google.com/recommender
|
|
139
150
|
.. _README: https://github.com/googleapis/google-cloud-python/blob/main/README.rst
|
|
151
|
+
|
|
152
|
+
Logging
|
|
153
|
+
-------
|
|
154
|
+
|
|
155
|
+
This library uses the standard Python :code:`logging` functionality to log some RPC events that could be of interest for debugging and monitoring purposes.
|
|
156
|
+
Note the following:
|
|
157
|
+
|
|
158
|
+
#. Logs may contain sensitive information. Take care to **restrict access to the logs** if they are saved, whether it be on local storage or on Google Cloud Logging.
|
|
159
|
+
#. Google may refine the occurrence, level, and content of various log messages in this library without flagging such changes as breaking. **Do not depend on immutability of the logging events**.
|
|
160
|
+
#. By default, the logging events from this library are not handled. You must **explicitly configure log handling** using one of the mechanisms below.
|
|
161
|
+
|
|
162
|
+
Simple, environment-based configuration
|
|
163
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
164
|
+
|
|
165
|
+
To enable logging for this library without any changes in your code, set the :code:`GOOGLE_SDK_PYTHON_LOGGING_SCOPE` environment variable to a valid Google
|
|
166
|
+
logging scope. This configures handling of logging events (at level :code:`logging.DEBUG` or higher) from this library in a default manner, emitting the logged
|
|
167
|
+
messages in a structured format. It does not currently allow customizing the logging levels captured nor the handlers, formatters, etc. used for any logging
|
|
168
|
+
event.
|
|
169
|
+
|
|
170
|
+
A logging scope is a period-separated namespace that begins with :code:`google`, identifying the Python module or package to log.
|
|
171
|
+
|
|
172
|
+
- Valid logging scopes: :code:`google`, :code:`google.cloud.asset.v1`, :code:`google.api`, :code:`google.auth`, etc.
|
|
173
|
+
- Invalid logging scopes: :code:`foo`, :code:`123`, etc.
|
|
174
|
+
|
|
175
|
+
**NOTE**: If the logging scope is invalid, the library does not set up any logging handlers.
|
|
176
|
+
|
|
177
|
+
Environment-Based Examples
|
|
178
|
+
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
179
|
+
|
|
180
|
+
- Enabling the default handler for all Google-based loggers
|
|
181
|
+
|
|
182
|
+
.. code-block:: console
|
|
183
|
+
|
|
184
|
+
export GOOGLE_SDK_PYTHON_LOGGING_SCOPE=google
|
|
185
|
+
|
|
186
|
+
- Enabling the default handler for a specific Google module (for a client library called :code:`library_v1`):
|
|
187
|
+
|
|
188
|
+
.. code-block:: console
|
|
189
|
+
|
|
190
|
+
export GOOGLE_SDK_PYTHON_LOGGING_SCOPE=google.cloud.library_v1
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
Advanced, code-based configuration
|
|
194
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
195
|
+
|
|
196
|
+
You can also configure a valid logging scope using Python's standard `logging` mechanism.
|
|
197
|
+
|
|
198
|
+
Code-Based Examples
|
|
199
|
+
^^^^^^^^^^^^^^^^^^^
|
|
200
|
+
|
|
201
|
+
- Configuring a handler for all Google-based loggers
|
|
202
|
+
|
|
203
|
+
.. code-block:: python
|
|
204
|
+
|
|
205
|
+
import logging
|
|
206
|
+
|
|
207
|
+
from google.cloud import library_v1
|
|
208
|
+
|
|
209
|
+
base_logger = logging.getLogger("google")
|
|
210
|
+
base_logger.addHandler(logging.StreamHandler())
|
|
211
|
+
base_logger.setLevel(logging.DEBUG)
|
|
212
|
+
|
|
213
|
+
- Configuring a handler for a specific Google module (for a client library called :code:`library_v1`):
|
|
214
|
+
|
|
215
|
+
.. code-block:: python
|
|
216
|
+
|
|
217
|
+
import logging
|
|
218
|
+
|
|
219
|
+
from google.cloud import library_v1
|
|
220
|
+
|
|
221
|
+
base_logger = logging.getLogger("google.cloud.library_v1")
|
|
222
|
+
base_logger.addHandler(logging.StreamHandler())
|
|
223
|
+
base_logger.setLevel(logging.DEBUG)
|
|
224
|
+
|
|
225
|
+
Logging details
|
|
226
|
+
~~~~~~~~~~~~~~~
|
|
227
|
+
|
|
228
|
+
#. Regardless of which of the mechanisms above you use to configure logging for this library, by default logging events are not propagated up to the root
|
|
229
|
+
logger from the `google`-level logger. If you need the events to be propagated to the root logger, you must explicitly set
|
|
230
|
+
:code:`logging.getLogger("google").propagate = True` in your code.
|
|
231
|
+
#. You can mix the different logging configurations above for different Google modules. For example, you may want use a code-based logging configuration for
|
|
232
|
+
one library, but decide you need to also set up environment-based logging configuration for another library.
|
|
233
|
+
|
|
234
|
+
#. If you attempt to use both code-based and environment-based configuration for the same module, the environment-based configuration will be ineffectual
|
|
235
|
+
if the code -based configuration gets applied first.
|
|
236
|
+
|
|
237
|
+
#. The Google-specific logging configurations (default handlers for environment-based configuration; not propagating logging events to the root logger) get
|
|
238
|
+
executed the first time *any* client library is instantiated in your application, and only if the affected loggers have not been previously configured.
|
|
239
|
+
(This is the reason for 2.i. above.)
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
Python Client for Cloud Recommender
|
|
2
|
+
===================================
|
|
3
|
+
|
|
4
|
+
|stable| |pypi| |versions|
|
|
5
|
+
|
|
6
|
+
`Cloud Recommender`_: delivers highly personalized product recommendations at scale.
|
|
7
|
+
|
|
8
|
+
- `Client Library Documentation`_
|
|
9
|
+
- `Product Documentation`_
|
|
10
|
+
|
|
11
|
+
.. |stable| image:: https://img.shields.io/badge/support-stable-gold.svg
|
|
12
|
+
:target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#stability-levels
|
|
13
|
+
.. |pypi| image:: https://img.shields.io/pypi/v/google-cloud-recommender.svg
|
|
14
|
+
:target: https://pypi.org/project/google-cloud-recommender/
|
|
15
|
+
.. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-recommender.svg
|
|
16
|
+
:target: https://pypi.org/project/google-cloud-recommender/
|
|
17
|
+
.. _Cloud Recommender: https://cloud.google.com/recommender
|
|
18
|
+
.. _Client Library Documentation: https://cloud.google.com/python/docs/reference/recommender/latest/summary_overview
|
|
19
|
+
.. _Product Documentation: https://cloud.google.com/recommender
|
|
20
|
+
|
|
21
|
+
Quick Start
|
|
22
|
+
-----------
|
|
23
|
+
|
|
24
|
+
In order to use this library, you first need to go through the following steps:
|
|
25
|
+
|
|
26
|
+
1. `Select or create a Cloud Platform project.`_
|
|
27
|
+
2. `Enable billing for your project.`_
|
|
28
|
+
3. `Enable the Cloud Recommender.`_
|
|
29
|
+
4. `Set up Authentication.`_
|
|
30
|
+
|
|
31
|
+
.. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project
|
|
32
|
+
.. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project
|
|
33
|
+
.. _Enable the Cloud Recommender.: https://cloud.google.com/recommender
|
|
34
|
+
.. _Set up Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html
|
|
35
|
+
|
|
36
|
+
Installation
|
|
37
|
+
~~~~~~~~~~~~
|
|
38
|
+
|
|
39
|
+
Install this library in a virtual environment using `venv`_. `venv`_ is a tool that
|
|
40
|
+
creates isolated Python environments. These isolated environments can have separate
|
|
41
|
+
versions of Python packages, which allows you to isolate one project's dependencies
|
|
42
|
+
from the dependencies of other projects.
|
|
43
|
+
|
|
44
|
+
With `venv`_, it's possible to install this library without needing system
|
|
45
|
+
install permissions, and without clashing with the installed system
|
|
46
|
+
dependencies.
|
|
47
|
+
|
|
48
|
+
.. _`venv`: https://docs.python.org/3/library/venv.html
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
Code samples and snippets
|
|
52
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
53
|
+
|
|
54
|
+
Code samples and snippets live in the `samples/`_ folder.
|
|
55
|
+
|
|
56
|
+
.. _samples/: https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-recommender/samples
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
Supported Python Versions
|
|
60
|
+
^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
61
|
+
Our client libraries are compatible with all current `active`_ and `maintenance`_ versions of
|
|
62
|
+
Python.
|
|
63
|
+
|
|
64
|
+
Python >= 3.7
|
|
65
|
+
|
|
66
|
+
.. _active: https://devguide.python.org/devcycle/#in-development-main-branch
|
|
67
|
+
.. _maintenance: https://devguide.python.org/devcycle/#maintenance-branches
|
|
68
|
+
|
|
69
|
+
Unsupported Python Versions
|
|
70
|
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
71
|
+
Python <= 3.6
|
|
72
|
+
|
|
73
|
+
If you are using an `end-of-life`_
|
|
74
|
+
version of Python, we recommend that you update as soon as possible to an actively supported version.
|
|
75
|
+
|
|
76
|
+
.. _end-of-life: https://devguide.python.org/devcycle/#end-of-life-branches
|
|
77
|
+
|
|
78
|
+
Mac/Linux
|
|
79
|
+
^^^^^^^^^
|
|
80
|
+
|
|
81
|
+
.. code-block:: console
|
|
82
|
+
|
|
83
|
+
python3 -m venv <your-env>
|
|
84
|
+
source <your-env>/bin/activate
|
|
85
|
+
pip install google-cloud-recommender
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
Windows
|
|
89
|
+
^^^^^^^
|
|
90
|
+
|
|
91
|
+
.. code-block:: console
|
|
92
|
+
|
|
93
|
+
py -m venv <your-env>
|
|
94
|
+
.\<your-env>\Scripts\activate
|
|
95
|
+
pip install google-cloud-recommender
|
|
96
|
+
|
|
97
|
+
Next Steps
|
|
98
|
+
~~~~~~~~~~
|
|
99
|
+
|
|
100
|
+
- Read the `Client Library Documentation`_ for Cloud Recommender
|
|
101
|
+
to see other available methods on the client.
|
|
102
|
+
- Read the `Cloud Recommender Product documentation`_ to learn
|
|
103
|
+
more about the product and see How-to Guides.
|
|
104
|
+
- View this `README`_ to see the full list of Cloud
|
|
105
|
+
APIs that we cover.
|
|
106
|
+
|
|
107
|
+
.. _Cloud Recommender Product documentation: https://cloud.google.com/recommender
|
|
108
|
+
.. _README: https://github.com/googleapis/google-cloud-python/blob/main/README.rst
|
|
109
|
+
|
|
110
|
+
Logging
|
|
111
|
+
-------
|
|
112
|
+
|
|
113
|
+
This library uses the standard Python :code:`logging` functionality to log some RPC events that could be of interest for debugging and monitoring purposes.
|
|
114
|
+
Note the following:
|
|
115
|
+
|
|
116
|
+
#. Logs may contain sensitive information. Take care to **restrict access to the logs** if they are saved, whether it be on local storage or on Google Cloud Logging.
|
|
117
|
+
#. Google may refine the occurrence, level, and content of various log messages in this library without flagging such changes as breaking. **Do not depend on immutability of the logging events**.
|
|
118
|
+
#. By default, the logging events from this library are not handled. You must **explicitly configure log handling** using one of the mechanisms below.
|
|
119
|
+
|
|
120
|
+
Simple, environment-based configuration
|
|
121
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
122
|
+
|
|
123
|
+
To enable logging for this library without any changes in your code, set the :code:`GOOGLE_SDK_PYTHON_LOGGING_SCOPE` environment variable to a valid Google
|
|
124
|
+
logging scope. This configures handling of logging events (at level :code:`logging.DEBUG` or higher) from this library in a default manner, emitting the logged
|
|
125
|
+
messages in a structured format. It does not currently allow customizing the logging levels captured nor the handlers, formatters, etc. used for any logging
|
|
126
|
+
event.
|
|
127
|
+
|
|
128
|
+
A logging scope is a period-separated namespace that begins with :code:`google`, identifying the Python module or package to log.
|
|
129
|
+
|
|
130
|
+
- Valid logging scopes: :code:`google`, :code:`google.cloud.asset.v1`, :code:`google.api`, :code:`google.auth`, etc.
|
|
131
|
+
- Invalid logging scopes: :code:`foo`, :code:`123`, etc.
|
|
132
|
+
|
|
133
|
+
**NOTE**: If the logging scope is invalid, the library does not set up any logging handlers.
|
|
134
|
+
|
|
135
|
+
Environment-Based Examples
|
|
136
|
+
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
137
|
+
|
|
138
|
+
- Enabling the default handler for all Google-based loggers
|
|
139
|
+
|
|
140
|
+
.. code-block:: console
|
|
141
|
+
|
|
142
|
+
export GOOGLE_SDK_PYTHON_LOGGING_SCOPE=google
|
|
143
|
+
|
|
144
|
+
- Enabling the default handler for a specific Google module (for a client library called :code:`library_v1`):
|
|
145
|
+
|
|
146
|
+
.. code-block:: console
|
|
147
|
+
|
|
148
|
+
export GOOGLE_SDK_PYTHON_LOGGING_SCOPE=google.cloud.library_v1
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
Advanced, code-based configuration
|
|
152
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
153
|
+
|
|
154
|
+
You can also configure a valid logging scope using Python's standard `logging` mechanism.
|
|
155
|
+
|
|
156
|
+
Code-Based Examples
|
|
157
|
+
^^^^^^^^^^^^^^^^^^^
|
|
158
|
+
|
|
159
|
+
- Configuring a handler for all Google-based loggers
|
|
160
|
+
|
|
161
|
+
.. code-block:: python
|
|
162
|
+
|
|
163
|
+
import logging
|
|
164
|
+
|
|
165
|
+
from google.cloud import library_v1
|
|
166
|
+
|
|
167
|
+
base_logger = logging.getLogger("google")
|
|
168
|
+
base_logger.addHandler(logging.StreamHandler())
|
|
169
|
+
base_logger.setLevel(logging.DEBUG)
|
|
170
|
+
|
|
171
|
+
- Configuring a handler for a specific Google module (for a client library called :code:`library_v1`):
|
|
172
|
+
|
|
173
|
+
.. code-block:: python
|
|
174
|
+
|
|
175
|
+
import logging
|
|
176
|
+
|
|
177
|
+
from google.cloud import library_v1
|
|
178
|
+
|
|
179
|
+
base_logger = logging.getLogger("google.cloud.library_v1")
|
|
180
|
+
base_logger.addHandler(logging.StreamHandler())
|
|
181
|
+
base_logger.setLevel(logging.DEBUG)
|
|
182
|
+
|
|
183
|
+
Logging details
|
|
184
|
+
~~~~~~~~~~~~~~~
|
|
185
|
+
|
|
186
|
+
#. Regardless of which of the mechanisms above you use to configure logging for this library, by default logging events are not propagated up to the root
|
|
187
|
+
logger from the `google`-level logger. If you need the events to be propagated to the root logger, you must explicitly set
|
|
188
|
+
:code:`logging.getLogger("google").propagate = True` in your code.
|
|
189
|
+
#. You can mix the different logging configurations above for different Google modules. For example, you may want use a code-based logging configuration for
|
|
190
|
+
one library, but decide you need to also set up environment-based logging configuration for another library.
|
|
191
|
+
|
|
192
|
+
#. If you attempt to use both code-based and environment-based configuration for the same module, the environment-based configuration will be ineffectual
|
|
193
|
+
if the code -based configuration gets applied first.
|
|
194
|
+
|
|
195
|
+
#. The Google-specific logging configurations (default handlers for environment-based configuration; not propagating logging events to the root logger) get
|
|
196
|
+
executed the first time *any* client library is instantiated in your application, and only if the affected loggers have not been previously configured.
|
|
197
|
+
(This is the reason for 2.i. above.)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
|
-
# Copyright
|
|
2
|
+
# Copyright 2025 Google LLC
|
|
3
3
|
#
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
# you may not use this file except in compliance with the License.
|
|
@@ -13,4 +13,4 @@
|
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
#
|
|
16
|
-
__version__ = "2.18.
|
|
16
|
+
__version__ = "2.18.2" # {x-release-please-version}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
|
-
# Copyright
|
|
2
|
+
# Copyright 2025 Google LLC
|
|
3
3
|
#
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
# you may not use this file except in compliance with the License.
|
|
@@ -13,4 +13,4 @@
|
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
#
|
|
16
|
-
__version__ = "2.18.
|
|
16
|
+
__version__ = "2.18.2" # {x-release-please-version}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
|
-
# Copyright
|
|
2
|
+
# Copyright 2025 Google LLC
|
|
3
3
|
#
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
# you may not use this file except in compliance with the License.
|
|
@@ -35,6 +35,7 @@ from google.api_core import retry_async as retries
|
|
|
35
35
|
from google.api_core.client_options import ClientOptions
|
|
36
36
|
from google.auth import credentials as ga_credentials # type: ignore
|
|
37
37
|
from google.oauth2 import service_account # type: ignore
|
|
38
|
+
import google.protobuf
|
|
38
39
|
|
|
39
40
|
from google.cloud.recommender_v1 import gapic_version as package_version
|
|
40
41
|
|
|
@@ -402,7 +403,10 @@ class RecommenderAsyncClient:
|
|
|
402
403
|
# Create or coerce a protobuf request object.
|
|
403
404
|
# - Quick check: If we got a request object, we should *not* have
|
|
404
405
|
# gotten any keyword arguments that map to the request.
|
|
405
|
-
|
|
406
|
+
flattened_params = [parent]
|
|
407
|
+
has_flattened_params = (
|
|
408
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
409
|
+
)
|
|
406
410
|
if request is not None and has_flattened_params:
|
|
407
411
|
raise ValueError(
|
|
408
412
|
"If the `request` argument is set, then none of "
|
|
@@ -521,7 +525,10 @@ class RecommenderAsyncClient:
|
|
|
521
525
|
# Create or coerce a protobuf request object.
|
|
522
526
|
# - Quick check: If we got a request object, we should *not* have
|
|
523
527
|
# gotten any keyword arguments that map to the request.
|
|
524
|
-
|
|
528
|
+
flattened_params = [name]
|
|
529
|
+
has_flattened_params = (
|
|
530
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
531
|
+
)
|
|
525
532
|
if request is not None and has_flattened_params:
|
|
526
533
|
raise ValueError(
|
|
527
534
|
"If the `request` argument is set, then none of "
|
|
@@ -654,7 +661,10 @@ class RecommenderAsyncClient:
|
|
|
654
661
|
# Create or coerce a protobuf request object.
|
|
655
662
|
# - Quick check: If we got a request object, we should *not* have
|
|
656
663
|
# gotten any keyword arguments that map to the request.
|
|
657
|
-
|
|
664
|
+
flattened_params = [name, state_metadata, etag]
|
|
665
|
+
has_flattened_params = (
|
|
666
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
667
|
+
)
|
|
658
668
|
if request is not None and has_flattened_params:
|
|
659
669
|
raise ValueError(
|
|
660
670
|
"If the `request` argument is set, then none of "
|
|
@@ -821,7 +831,10 @@ class RecommenderAsyncClient:
|
|
|
821
831
|
# Create or coerce a protobuf request object.
|
|
822
832
|
# - Quick check: If we got a request object, we should *not* have
|
|
823
833
|
# gotten any keyword arguments that map to the request.
|
|
824
|
-
|
|
834
|
+
flattened_params = [parent, filter]
|
|
835
|
+
has_flattened_params = (
|
|
836
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
837
|
+
)
|
|
825
838
|
if request is not None and has_flattened_params:
|
|
826
839
|
raise ValueError(
|
|
827
840
|
"If the `request` argument is set, then none of "
|
|
@@ -944,7 +957,10 @@ class RecommenderAsyncClient:
|
|
|
944
957
|
# Create or coerce a protobuf request object.
|
|
945
958
|
# - Quick check: If we got a request object, we should *not* have
|
|
946
959
|
# gotten any keyword arguments that map to the request.
|
|
947
|
-
|
|
960
|
+
flattened_params = [name]
|
|
961
|
+
has_flattened_params = (
|
|
962
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
963
|
+
)
|
|
948
964
|
if request is not None and has_flattened_params:
|
|
949
965
|
raise ValueError(
|
|
950
966
|
"If the `request` argument is set, then none of "
|
|
@@ -1182,7 +1198,10 @@ class RecommenderAsyncClient:
|
|
|
1182
1198
|
# Create or coerce a protobuf request object.
|
|
1183
1199
|
# - Quick check: If we got a request object, we should *not* have
|
|
1184
1200
|
# gotten any keyword arguments that map to the request.
|
|
1185
|
-
|
|
1201
|
+
flattened_params = [name, state_metadata, etag]
|
|
1202
|
+
has_flattened_params = (
|
|
1203
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
1204
|
+
)
|
|
1186
1205
|
if request is not None and has_flattened_params:
|
|
1187
1206
|
raise ValueError(
|
|
1188
1207
|
"If the `request` argument is set, then none of "
|
|
@@ -1328,7 +1347,10 @@ class RecommenderAsyncClient:
|
|
|
1328
1347
|
# Create or coerce a protobuf request object.
|
|
1329
1348
|
# - Quick check: If we got a request object, we should *not* have
|
|
1330
1349
|
# gotten any keyword arguments that map to the request.
|
|
1331
|
-
|
|
1350
|
+
flattened_params = [name, state_metadata, etag]
|
|
1351
|
+
has_flattened_params = (
|
|
1352
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
1353
|
+
)
|
|
1332
1354
|
if request is not None and has_flattened_params:
|
|
1333
1355
|
raise ValueError(
|
|
1334
1356
|
"If the `request` argument is set, then none of "
|
|
@@ -1474,7 +1496,10 @@ class RecommenderAsyncClient:
|
|
|
1474
1496
|
# Create or coerce a protobuf request object.
|
|
1475
1497
|
# - Quick check: If we got a request object, we should *not* have
|
|
1476
1498
|
# gotten any keyword arguments that map to the request.
|
|
1477
|
-
|
|
1499
|
+
flattened_params = [name, state_metadata, etag]
|
|
1500
|
+
has_flattened_params = (
|
|
1501
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
1502
|
+
)
|
|
1478
1503
|
if request is not None and has_flattened_params:
|
|
1479
1504
|
raise ValueError(
|
|
1480
1505
|
"If the `request` argument is set, then none of "
|
|
@@ -1596,7 +1621,10 @@ class RecommenderAsyncClient:
|
|
|
1596
1621
|
# Create or coerce a protobuf request object.
|
|
1597
1622
|
# - Quick check: If we got a request object, we should *not* have
|
|
1598
1623
|
# gotten any keyword arguments that map to the request.
|
|
1599
|
-
|
|
1624
|
+
flattened_params = [name]
|
|
1625
|
+
has_flattened_params = (
|
|
1626
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
1627
|
+
)
|
|
1600
1628
|
if request is not None and has_flattened_params:
|
|
1601
1629
|
raise ValueError(
|
|
1602
1630
|
"If the `request` argument is set, then none of "
|
|
@@ -1709,7 +1737,10 @@ class RecommenderAsyncClient:
|
|
|
1709
1737
|
# Create or coerce a protobuf request object.
|
|
1710
1738
|
# - Quick check: If we got a request object, we should *not* have
|
|
1711
1739
|
# gotten any keyword arguments that map to the request.
|
|
1712
|
-
|
|
1740
|
+
flattened_params = [recommender_config, update_mask]
|
|
1741
|
+
has_flattened_params = (
|
|
1742
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
1743
|
+
)
|
|
1713
1744
|
if request is not None and has_flattened_params:
|
|
1714
1745
|
raise ValueError(
|
|
1715
1746
|
"If the `request` argument is set, then none of "
|
|
@@ -1830,7 +1861,10 @@ class RecommenderAsyncClient:
|
|
|
1830
1861
|
# Create or coerce a protobuf request object.
|
|
1831
1862
|
# - Quick check: If we got a request object, we should *not* have
|
|
1832
1863
|
# gotten any keyword arguments that map to the request.
|
|
1833
|
-
|
|
1864
|
+
flattened_params = [name]
|
|
1865
|
+
has_flattened_params = (
|
|
1866
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
1867
|
+
)
|
|
1834
1868
|
if request is not None and has_flattened_params:
|
|
1835
1869
|
raise ValueError(
|
|
1836
1870
|
"If the `request` argument is set, then none of "
|
|
@@ -1943,7 +1977,10 @@ class RecommenderAsyncClient:
|
|
|
1943
1977
|
# Create or coerce a protobuf request object.
|
|
1944
1978
|
# - Quick check: If we got a request object, we should *not* have
|
|
1945
1979
|
# gotten any keyword arguments that map to the request.
|
|
1946
|
-
|
|
1980
|
+
flattened_params = [insight_type_config, update_mask]
|
|
1981
|
+
has_flattened_params = (
|
|
1982
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
1983
|
+
)
|
|
1947
1984
|
if request is not None and has_flattened_params:
|
|
1948
1985
|
raise ValueError(
|
|
1949
1986
|
"If the `request` argument is set, then none of "
|
|
@@ -2001,5 +2038,8 @@ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
|
|
|
2001
2038
|
gapic_version=package_version.__version__
|
|
2002
2039
|
)
|
|
2003
2040
|
|
|
2041
|
+
if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
|
|
2042
|
+
DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
|
|
2043
|
+
|
|
2004
2044
|
|
|
2005
2045
|
__all__ = ("RecommenderAsyncClient",)
|