Skip to content

Commit

Permalink
add apigateway request max retries, in my testing fixed issues #48 and
Browse files Browse the repository at this point in the history
  • Loading branch information
knavesec committed Aug 2, 2023
1 parent aea79a2 commit 0ed33a4
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions utils/fire.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from multiprocessing import Pool
import tldextract
import boto3
from botocore.config import Config
import os
import sys
import datetime
Expand Down Expand Up @@ -42,11 +43,15 @@ def _try_instance_profile(self) -> bool:
"""
try:
if not self.region:
self.client = boto3.client('apigateway')
self.client = boto3.client(
'apigateway',
config=Config(retries = dict(max_attempts = 10))
)
else:
self.client = boto3.client(
'apigateway',
region_name=self.region
region_name=self.region,
config=Config(retries = dict(max_attempts = 10))
)
self.client.get_account()
self.region = self.client._client_config.region_name
Expand Down Expand Up @@ -75,7 +80,7 @@ def load_creds(self) -> bool:
return False
self.region = config[config_profile_section].get('region', 'us-east-1')
try:
self.client = boto3.session.Session(profile_name=self.profile_name).client('apigateway')
self.client = boto3.session.Session(profile_name=self.profile_name).client('apigateway', config=Config(retries = dict(max_attempts = 10)))
self.client.get_account()
return True
except:
Expand All @@ -88,7 +93,8 @@ def load_creds(self) -> bool:
aws_access_key_id=self.access_key,
aws_secret_access_key=self.secret_access_key,
aws_session_token=self.session_token,
region_name=self.region
region_name=self.region,
config=Config(retries = dict(max_attempts = 10))
)
self.client.get_account()
self.region = self.client._client_config.region_name
Expand Down

0 comments on commit 0ed33a4

Please sign in to comment.