@@ -63,12 +63,13 @@ class AlphaAnalyticsDataRestInterceptor:
6363
6464 .. code-block:: python
6565 class MyCustomAlphaAnalyticsDataInterceptor(AlphaAnalyticsDataRestInterceptor):
66- def pre_run_funnel_report(request, metadata):
66+ def pre_run_funnel_report(self, request, metadata):
6767 logging.log(f"Received request: {request}")
6868 return request, metadata
6969
70- def post_run_funnel_report(response):
70+ def post_run_funnel_report(self, response):
7171 logging.log(f"Received response: {response}")
72+ return response
7273
7374 transport = AlphaAnalyticsDataRestTransport(interceptor=MyCustomAlphaAnalyticsDataInterceptor())
7475 client = AlphaAnalyticsDataClient(transport=transport)
@@ -118,9 +119,6 @@ class AlphaAnalyticsDataRestTransport(AlphaAnalyticsDataTransport):
118119
119120 It sends JSON representations of protocol buffers over HTTP/1.1
120121
121- NOTE: This REST transport functionality is currently in a beta
122- state (preview). We welcome your feedback via an issue in this
123- library's source repository. Thank you!
124122 """
125123
126124 def __init__ (
@@ -140,39 +138,35 @@ def __init__(
140138 ) -> None :
141139 """Instantiate the transport.
142140
143- NOTE: This REST transport functionality is currently in a beta
144- state (preview). We welcome your feedback via a GitHub issue in
145- this library's repository. Thank you!
146-
147- Args:
148- host (Optional[str]):
149- The hostname to connect to.
150- credentials (Optional[google.auth.credentials.Credentials]): The
151- authorization credentials to attach to requests. These
152- credentials identify the application to the service; if none
153- are specified, the client will attempt to ascertain the
154- credentials from the environment.
155-
156- credentials_file (Optional[str]): A file with credentials that can
157- be loaded with :func:`google.auth.load_credentials_from_file`.
158- This argument is ignored if ``channel`` is provided.
159- scopes (Optional(Sequence[str])): A list of scopes. This argument is
160- ignored if ``channel`` is provided.
161- client_cert_source_for_mtls (Callable[[], Tuple[bytes, bytes]]): Client
162- certificate to configure mutual TLS HTTP channel. It is ignored
163- if ``channel`` is provided.
164- quota_project_id (Optional[str]): An optional project to use for billing
165- and quota.
166- client_info (google.api_core.gapic_v1.client_info.ClientInfo):
167- The client info used to send a user-agent string along with
168- API requests. If ``None``, then default info will be used.
169- Generally, you only need to set this if you are developing
170- your own client library.
171- always_use_jwt_access (Optional[bool]): Whether self signed JWT should
172- be used for service account credentials.
173- url_scheme: the protocol scheme for the API endpoint. Normally
174- "https", but for testing or local servers,
175- "http" can be specified.
141+ Args:
142+ host (Optional[str]):
143+ The hostname to connect to.
144+ credentials (Optional[google.auth.credentials.Credentials]): The
145+ authorization credentials to attach to requests. These
146+ credentials identify the application to the service; if none
147+ are specified, the client will attempt to ascertain the
148+ credentials from the environment.
149+
150+ credentials_file (Optional[str]): A file with credentials that can
151+ be loaded with :func:`google.auth.load_credentials_from_file`.
152+ This argument is ignored if ``channel`` is provided.
153+ scopes (Optional(Sequence[str])): A list of scopes. This argument is
154+ ignored if ``channel`` is provided.
155+ client_cert_source_for_mtls (Callable[[], Tuple[bytes, bytes]]): Client
156+ certificate to configure mutual TLS HTTP channel. It is ignored
157+ if ``channel`` is provided.
158+ quota_project_id (Optional[str]): An optional project to use for billing
159+ and quota.
160+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
161+ The client info used to send a user-agent string along with
162+ API requests. If ``None``, then default info will be used.
163+ Generally, you only need to set this if you are developing
164+ your own client library.
165+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
166+ be used for service account credentials.
167+ url_scheme: the protocol scheme for the API endpoint. Normally
168+ "https", but for testing or local servers,
169+ "http" can be specified.
176170 """
177171 # Run the base constructor
178172 # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc.
@@ -253,7 +247,7 @@ def __call__(
253247 body = json_format .MessageToJson (
254248 transcoded_request ["body" ],
255249 including_default_value_fields = False ,
256- use_integers_for_enums = False ,
250+ use_integers_for_enums = True ,
257251 )
258252 uri = transcoded_request ["uri" ]
259253 method = transcoded_request ["method" ]
@@ -263,10 +257,12 @@ def __call__(
263257 json_format .MessageToJson (
264258 transcoded_request ["query_params" ],
265259 including_default_value_fields = False ,
266- use_integers_for_enums = False ,
260+ use_integers_for_enums = True ,
267261 )
268262 )
269263
264+ query_params ["$alt" ] = "json;enum-encoding=int"
265+
270266 # Send the request
271267 headers = dict (metadata )
272268 headers ["Content-Type" ] = "application/json"
0 commit comments