googleapis / googleapis/google-cloud-python

Improve support for `X-Goog-FieldMask` header

Đang mở
#16,296 3 bình luận 0 reaction 1 người được giao Được @ohmayr nhận Xem trên GitHub
api: places type: feature request
Ngôn ngữ chính
Python
Star
5.4k
Fork
1.8k
Merge trung bình
3 ngày 4 giờ
Pull request đã merge (30 ngày)
122

Mô tả

#### Environment details

- OS type and version: MacOS 14.5 (23F79)
- Python version: 3.12.3
- pip version: 24.0
- `google-api-core` version: 2.19.1

#### Steps to reproduce

1. Set up `PlacesAsyncClient`
2. Make a `search_text` request

#### Code example

```python
from google.auth.api_key import Credentials
from google.maps import places_v1
from google.protobuf import field_mask_pb2
from google.type import latlng_pb2

async def sample_search_text():
api_key = "..."

# Field mask goes where?
field_mask=field_mask_pb2.FieldMask(paths=["places.displayName", "places.id"]),

client = places_v1.PlacesAsyncClient(
credentials=Credentials(token=api_key)
)

request = places_v1.SearchTextRequest(
text_query="21 Great Winchester Street, London",
location_bias=places_v1.SearchTextRequest.LocationBias(
circle=places_v1.Circle(
center=latlng_pb2.LatLng(
latitude=51.519993, longitude=-0.0813288
),
radius=1000,
)
),
max_result_count=20,
)

response = await client.search_text(request=request)

print(response)

if __name__ == "__main__":
import asyncio

asyncio.run(sample_search_text())

```

#### Stack trace
```
google.api_core.exceptions.InvalidArgument: 400 FieldMask is a required parameter. See https://cloud.google.com/apis/docs/system-parameters on how to provide it. As an example, you can set the header 'X-Goog-FieldMask' to value 'places.displayName', 'places.id' to ask for the display name and the place id of a place. You can also set the value to '*' in manual testing to get all the available response fields.
```

Making sure to follow these steps will guarantee the quickest resolution possible.

Thanks!

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.