googleapis / googleapis/google-api-python-client

Disable prettyPrint by default for Google Sheets API responses

未關閉 適合新手
#2,788 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

主要語言
Python
星號
8.9k
分支
2.6k
平均合併
2 天 28 分鐘
30 天內合併 PR
17

描述

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.

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

在 repository 中定位 Sheets API discovery document,並搜尋 prettyPrint 參數及其預設值。將文件中記載的預設值變更為 false,同時保留呼叫端明確提供的值,然後執行相關測試套件或 discovery document 測試,以驗證要求預設使用 prettyPrint=false。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
python
領域
api
Issue 類型
功能
難度
2/5
預估耗時
1-3 小時
活躍度
冷清
描述清晰度
基本清楚
新手友好度
68/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。