Skip to content

Commit 3d0356c

Browse files
committed
Fix occasional "endpoint_resolver" failures
It seems that the boto3 library is not threadsafe. The solution discussed in GitHub issues such as boto/botocore#1246 boto/boto3#1592 and the documentation at https://boto3.amazonaws.com/v1/documentation/api/latest/guide/resources.html?highlight=multithreading#multithreading-multiprocessing suggest a very simple change that sems to make things work.
1 parent 36a6f06 commit 3d0356c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

handprint/services/amazon.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ def amazon_result(self, file_path, variant, api_method, image_keyword,
8282
if __debug__: log('setting up Amazon client function "{}"', variant)
8383
creds = self._credentials
8484
try:
85-
client = boto3.client(variant, region_name = creds['region_name'],
85+
session = boto3.session.Session()
86+
client = session.client(variant, region_name = creds['region_name'],
8687
aws_access_key_id = creds['aws_access_key_id'],
8788
aws_secret_access_key = creds['aws_secret_access_key'])
8889
if __debug__: log('calling Amazon API function')

0 commit comments

Comments
 (0)