[Messenger] Adding retries for retriable errors
@@ -193,6 +193,15 @@ class MessageSender():
json=message,
)
result = response.json()
+ if 'error' in result:
+ if result['error']['code'] == 1200:
+ #temporary error please retry
+ response = requests.post(
+ api_address,
+ params=self.auth_args,
+ json=message,
+ )
+ result = response.json()
shared_utils.print_and_log(
logging.INFO,
'"Facebook response from message send: {}"'.format(result)
@@ -223,6 +232,15 @@ class MessageSender():
json=payload
)
result = response.json()
+ if 'error' in result:
+ if result['error']['code'] == 1200:
+ #temporary error please retry
+ response = requests.post(
+ api_address,
+ params=self.auth_args,
+ json=payload,
+ )
+ result = response.json()
shared_utils.print_and_log(
logging.INFO,
'"Facebook response from message send: {}"'.format(result)
