Open
Description
I am trying to get google worksheet information in a batch call but getting the following from the server response
<HttpError 501 when requesting https://sheets.googleapis.com/v4/spreadsheets/1NYpP_4haZR-EuhlbccoQOut8psmyvDJr0FLHsePTwAI?ranges=%27Sandeep+-Wedding+Contributions%27%21B2&fields=sheets%28data%28rowData%28values%28effectiveFormat%2FnumberFormat%2Ftype%2CeffectiveValue%29%29%29%29&includeGridData=true&alt=json returned "Operation is not implemented, or supported, or enabled.". Details: "Operation is not implemented, or supported, or enabled.">
Environment details
- OS type and version: MacOS ventura 13.2.1
- Python version: 3.10.13
- pip version: 23
google-api-python-client
version: 2.78.0
Steps to reproduce
- A method which return googleapiclient http object, which on '.execute', makes the api call and returns the desired successfully
def get_sheet_data(sheet):
(service.spreadsheets()
.get(
spreadsheetId = sheet.sheet_id,
ranges = range_query,
'fields': 'sheets(data(rowData(values(effectiveFormat/numberFormat/type,effectiveValue))))',
'includeGridData': 'true', ))
- when I call the same above with batch, I get the mentioned above error
service = discovery.build(('sheets', 'v4'), http=http)
batch = service.new_http_batch_request()
for item in items:
batch.add(
get_sheet_data(item),
callback=another_method
)
batch.execute
- When executed, I get exception (amongst id, response and exception) the highlighted 501 response
Please note that this utility works fine with drive service, and also worked fine with google-api-python-client 1.6.2
Please let me know if you need more data, or this utility has been replaced by some other function
Tried below as well
https://googleapis.github.io/google-api-python-client/docs/epy/googleapiclient.http.BatchHttpRequest-class.html
HttpError: <HttpError 404 when requesting https://www.googleapis.com/batch returned "Not Found". Details: "
<!DOCTYPE html>
<html lang=en>
<meta charset=utf-8>
<meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
<title>Error 404 (Not Found)!!1</title>
<style>
*{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/logos/errorpage/error_logo-150x54.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/logos/errorpage/error_logo-150x54-2x.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/logos/errorpage/error_logo-150x54-2x.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/logos/errorpage/error_logo-150x54-2x.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}
</style>
<a href=//www.google.com/><span id=logo aria-label=Google></span></a>
<p><b>404.</b> <ins>That’s an error.</ins>
<p> <ins>That’s all we know.</ins>
">