I'm getting Http 429 Error when request to create a lot of message at the same time using Google Chat API. What is the limit of instant maximum request? Why am I getting this error.How can I solve this?
Note: I checked to quota page. "https://console.cloud.google.com/apis/api/chat.googleapis.com/quotas?"
But
"Write requests per minute":
Limit:6000, Usage:405
Sample code block:
from oauth2client.service_account import ServiceAccountCredentials
from googleapiclient.discovery import build
from googleapiclient.errors import HttpError
def get_client(service):
scopes_chat = 'https://www.googleapis.com/auth/chat.bot'
if service == "hangouts":
credentials = ServiceAccountCredentials.from_json_keyfile_name(s_account, scopes_chat)
return build('chat', 'v1', http=credentials.authorize(Http()), cache_discovery=False)
def send_alert_chat_notification(messages_with_product):
try:
hchat = get_client("hangouts")
messages = messages_with_product[product]
for message in messages:
hchat.spaces().messages().create(
parent=space_name,
body=message).execute()
except HttpError as e:
logger.error("HTTP Error: Status: {}, Error: {}".format(str(e.resp.status), str(e)))
return e
Error:
ERROR - HTTP Error: Status: 429, Error: <HttpError 429 when requesting https://chat.googleapis.com/v1/spaces/***/messages?alt=json returned "Resource has been exhausted (e.g. check quota).". Details: "Resource has been exhausted (e.g. check quota).">