Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces the v1 version of the Google Shopping Merchant Reviews client library, adding the corresponding services, transports (gRPC and REST), types, unit tests, and generated samples. The reviewer identified three instances in the REST transport implementation (rest.py) where logging blocks incorrectly attempt to serialize the raw requests.Response object using to_json() instead of the parsed response message (resp). This would lead to exceptions and cause the logged payload to always be null. Actionable code suggestions were provided to fix these serialization calls.
| logging.DEBUG | ||
| ): # pragma: NO COVER | ||
| try: | ||
| response_payload = productreviews.ProductReview.to_json(response) |
There was a problem hiding this comment.
In the logging block, productreviews.ProductReview.to_json() is called with response (which is a requests.Response object) instead of resp (the parsed ProductReview message). This will always raise an exception and result in response_payload being None. It should be updated to use resp.
| response_payload = productreviews.ProductReview.to_json(response) | |
| response_payload = productreviews.ProductReview.to_json(resp) |
| logging.DEBUG | ||
| ): # pragma: NO COVER | ||
| try: | ||
| response_payload = productreviews.ProductReview.to_json(response) |
There was a problem hiding this comment.
In the logging block, productreviews.ProductReview.to_json() is called with response (which is a requests.Response object) instead of resp (the parsed ProductReview message). This will always raise an exception and result in response_payload being None. It should be updated to use resp.
| response_payload = productreviews.ProductReview.to_json(response) | |
| response_payload = productreviews.ProductReview.to_json(resp) |
| response_payload = ( | ||
| productreviews.ListProductReviewsResponse.to_json(response) | ||
| ) |
There was a problem hiding this comment.
In the logging block, productreviews.ListProductReviewsResponse.to_json() is called with response (which is a requests.Response object) instead of resp (the parsed ListProductReviewsResponse message). This will always raise an exception and result in response_payload being None. It should be updated to use resp.
| response_payload = ( | |
| productreviews.ListProductReviewsResponse.to_json(response) | |
| ) | |
| response_payload = ( | |
| productreviews.ListProductReviewsResponse.to_json(resp) | |
| ) |
|
Hi @daniel-sanche, could you please take a look at this library onboarding PR when you get a chance? Thanks! |
Onboard google/shopping/merchant/reviews/v1 API (google-shopping-merchant-reviews).
Internal tracking bug http://b/574418244
PiperOrigin-RevId: 1000790478
Debug Info
System Details
Commands Executed
python3 -m venv venv && source venv/bin/activatepip install --upgrade pipgo run github.com/googleapis/librarian/cmd/librarian@v0.49.0 installgo run github.com/googleapis/librarian/cmd/librarian@v0.49.0 add google/shopping/merchant/reviews/v1go run github.com/googleapis/librarian/cmd/librarian@v0.49.0 generate -v google-shopping-merchant-reviewsgo run github.com/googleapis/librarian/cmd/librarian@v0.49.0 tidygit add .git commit -m "feat(google/shopping/merchant/reviews/v1): add google-shopping-merchant-reviews"