aracılığıyla yapılan her çağrı için HttpError 404'ü döndürür. google-api-python-client tabanlı bir küçük uygulamanız var, ancak toplu iş isteği artık birkaç gün boyunca çalışmıyor (hata 404). Örneğin, aşağıdaki kod birkaç gün öncesine kadar gayet iyi çalışmıştır. ben bunu çalıştırırsanızGoogle API toplu isteği, Python istemcisi
from apiclient.http import BatchHttpRequest
from apiclient.discovery import build
import json
DEVELOPER_KEY = "foobar"
YOUTUBE_API_SERVICE_NAME = "youtube"
YOUTUBE_API_VERSION = "v3"
channelIds = ['UC2C_jShtL725hvbm1arSV9w','UC2C_jShtL725hvbm1arSV9w']
parts_list = [
"id",
"brandingSettings",
]
fields_list = [
"items/id",
"items/brandingSettings/channel",
]
parts = ",".join(parts_list)
fields = ",".join(fields_list)
request_map = {}
def this_is_the_callback_function(request_id, response, exception):
if exception is not None:
# Do something with the exception
print exception
pass
else:
print request_id
print request_map[int(request_id)]
print json.dumps(response,sort_keys=True, indent=4)
service = build(YOUTUBE_API_SERVICE_NAME, YOUTUBE_API_VERSION, developerKey=DEVELOPER_KEY)
batch = service.new_batch_http_request(callback=this_is_the_callback_function)
channels = service.channels()
i = 0
for c in channelIds:
i += 1
request_map[i] = c
request = channels.list(id=c,part=parts, fields=fields)
batch.add(request)
print request_map
batch.execute()
Şimdi, olsun:
{1: 'UC2C_jShtL725hvbm1arSV9w', 2: 'UC2C_jShtL725hvbm1arSV9w'}
<HttpError 404 when requesting https://www.googleapis.com/youtube/v3/channels?fields=items%2Fid%2Citems%2FbrandingSettings%2Fchannel&alt=json&part=id%2CbrandingSettings&id=UC2C_jShtL725hvbm1arSV9w&key=foobar returned "Not Found">
<HttpError 404 when requesting https://www.googleapis.com/youtube/v3/channels?fields=items%2Fid%2Citems%2FbrandingSettings%2Fchannel&alt=json&part=id%2CbrandingSettings&id=UC2C_jShtL725hvbm1arSV9w&key=foobar returned "Not Found">
Strange. Bana garip görünen şey, bu bağlantılara basit bir istekte bulunmaya çalışırsam (yalnızca tarayıcıdaki bir URL'yi keserek ve yapıştırarak), veriyi her zamanki gibi döndürür.
Buna bir yanıt buldunuz mu yoksa bir geçici çözüm buldunuz mu? Bende aynı sorunu yaşıyorum. – spuriousdata
Hello @spuriousdata. Cevap yok, şu an için bir çözüm yok: (neden olduguna dair bir fikriniz var mi? – floatingpurr
Bilmiyorum, ama google ile temasa geçtim ve onarmaya çalisiyor gibi görünüyorlar. – spuriousdata