Skip to content

Commit

Permalink
Techdebt: Fix compatibility with botocore 1.32.1 (getmoto#7030)
Browse files Browse the repository at this point in the history
  • Loading branch information
bblommers authored Nov 16, 2023
1 parent ed56ffd commit 1f84125
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions moto/core/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
method_names_from_class,
params_sort_function,
)
from moto.utilities.utils import load_resource
from moto.utilities.utils import load_resource, load_resource_as_bytes
from jinja2 import Environment, DictLoader, Template
from typing import (
Dict,
Expand Down Expand Up @@ -961,7 +961,12 @@ class AWSServiceSpec(object):
"""

def __init__(self, path: str):
spec = load_resource("botocore", path)
try:
spec = load_resource("botocore", path)
except FileNotFoundError:
# botocore >= 1.32.1 sends compressed files
compressed = load_resource_as_bytes("botocore", f"{path}.gz")
spec = json.loads(gzip_decompress(compressed).decode("utf-8"))

self.metadata = spec["metadata"]
self.operations = spec["operations"]
Expand Down

0 comments on commit 1f84125

Please sign in to comment.