googleapis / googleapis/google-api-python-client

Disable prettyPrint by default for Google Sheets API responses

Đang mở Phù hợp với người mới
#2,788 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
8.9k
Fork
2.6k
Merge trung bình
2 ngày 28 phút
Pull request đã merge (30 ngày)
17

Mô tả

Large Google Sheets API responses are currently pretty-printed by default. For machine-to-machine use, the additional whitespace and line breaks provide no benefit while increasing response size and I/O. When processing large responses, this can also contribute to unnecessary memory usage.

**Describe the solution you'd like**

Change the default value of `prettyPrint` from `true` to `false` for the Sheets API discovery document
and send `prettyPrint=false` unless the caller says otherwise.

**Describe alternatives you've considered**

The current workaround is to explicitly pass `prettyPrint=False` to every request. This works, but requires application code to opt out of an unnecessary default and is easy to miss, especially in codebases making many Sheets API requests.

Another option would be to modify the client code to inject `prettyPrint=False`, but changing the API discovery document's default seems simpler and more consistent with the intended API behavior.

Additional context

This is particularly relevant for applications processing large Sheets responses programmatically. Avoiding pretty printing would reduce the amount of data transferred and processed, as well as the memory required to hold the response in memory. For large responses, this can also help reduce peak process RSS.

As a bonus, this would make the default more appropriate for API clients, where responses are consumed programmatically rather than displayed directly to users.

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

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

Hướng nghiên cứu

Locate the Sheets API discovery document in the repository and search for the prettyPrint parameter and its default. Change the documented default to false while preserving an explicit caller value, then run the relevant test suite or discovery-document tests to verify requests use prettyPrint=false by default.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
api
Loại issue
Tính năng
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
68/100

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.