diff --git a/moto/core/responses.py b/moto/core/responses.py index 7c2f1c73..6cd9e24f 100644 --- a/moto/core/responses.py +++ b/moto/core/responses.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import os from collections import defaultdict import datetime import json @@ -25,7 +24,7 @@ from werkzeug.exceptions import HTTPException import boto3 from moto.compat import OrderedDict from moto.core.utils import camelcase_to_underscores, method_names_from_class - +from moto.settings import INITIAL_NO_AUTH_ACTION_COUNT log = logging.getLogger(__name__) @@ -108,11 +107,10 @@ class _TemplateEnvironmentMixin(object): class ActionAuthenticatorMixin(object): - INITIAL_NO_AUTH_ACTION_COUNT = float(os.environ.get("INITIAL_NO_AUTH_ACTION_COUNT", float("inf"))) request_count = 0 def _authenticate_action(self, iam_request_cls): - if ActionAuthenticatorMixin.request_count >= ActionAuthenticatorMixin.INITIAL_NO_AUTH_ACTION_COUNT: + if ActionAuthenticatorMixin.request_count >= INITIAL_NO_AUTH_ACTION_COUNT: iam_request = iam_request_cls(method=self.method, path=self.path, data=self.data, headers=self.headers) iam_request.check_signature() iam_request.check_action_permitted() diff --git a/moto/settings.py b/moto/settings.py index a5240f13..12402dc8 100644 --- a/moto/settings.py +++ b/moto/settings.py @@ -1,3 +1,4 @@ import os TEST_SERVER_MODE = os.environ.get('TEST_SERVER_MODE', '0').lower() == 'true' +INITIAL_NO_AUTH_ACTION_COUNT = float(os.environ.get('INITIAL_NO_AUTH_ACTION_COUNT', float('inf')))