在云函数中执行代码时收到状态 429 请求过多,但在本地执行时则没有收到状态 429 请求过多

问题描述 投票:0回答:1

我想使用云函数自动执行 api 调用,但它不起作用。 该代码在本地运行良好,但在使用云函数时收到 429。 有没有办法在代码中处理它?还是我的账户有问题? 这是 api 调用:

def get_visits(request):
endpoint = "https://api.mercadolibre.com/items/visits?ids=" + str(i) + "&date_from=" + str(yesterday) + "T00:00:00.000-00:00&date_to=" + str(today) + "T00:00:00.000-00:00"
payload={}
headers = {'Authorization': 'Bearer ' + access_token}
response = requests.get(endpoint, headers=headers, data=payload)
if response.status_code != 200:    
    print('API response: ', response.text)
else:
    return response.json()
python google-cloud-functions
1个回答
0
投票

我们实施了速率限制,以控制发送到 API 的请求。速率限制配置为每个卖家每分钟 1500 个请求,如果超过此限制,您将收到带有 429 状态代码的空响应。

© www.soinside.com 2019 - 2024. All rights reserved.