Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump boto3 from 1.28.84 to 1.34.2 #575

Merged
merged 2 commits into from
Dec 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
boto3==1.28.84
boto3==1.34.2
click==8.1.7
toolz==0.12.0
dateparser==1.2.0
Expand Down
2 changes: 1 addition & 1 deletion tests/boto_service_definitions_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

def test_should_find_most_recent_service_definition_file_for_ec2():
botocore_data_dir = resource_filename(Requirement.parse("botocore"), "botocore/data")
expected_filename = os.path.join(botocore_data_dir, "ec2", "2016-11-15", "service-2.json")
expected_filename = os.path.join(botocore_data_dir, "ec2", "2016-11-15", "service-2.json.gz")

assert service_definition_file("ec2") == expected_filename

Expand Down
14 changes: 8 additions & 6 deletions tests/test_utils_iam.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import gzip
import json
import logging

Expand All @@ -8,12 +9,13 @@ def all_aws_api_methods():
result = []

for line in boto_service_definition_files():
data = json.load(open(line.strip()))
if 'operations' in data:
for action in data['operations']:
result.append(data['metadata']['endpointPrefix'] + ":" + data['operations'][action]['name'])
else:
logging.warning('problem with %s', line.strip())
with gzip.open(line.strip()) as f:
data = json.load(f)
if 'operations' in data:
for action in data['operations']:
result.append(data['metadata']['endpointPrefix'] + ":" + data['operations'][action]['name'])
else:
logging.warning('problem with %s', line.strip())

return set(result)

Expand Down
7 changes: 4 additions & 3 deletions trailscraper/boto_service_definitions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Helper Methods to get service definition information out of the boto library"""
import fnmatch
import gzip
import json
import os

Expand All @@ -13,7 +14,7 @@ def boto_service_definition_files():
files = [os.path.join(dirname, file_in_dir)
for dirname, _, files_in_dir in os.walk(botocore_data_dir)
for file_in_dir in files_in_dir
if fnmatch.fnmatch(file_in_dir, 'service-*.json')]
if fnmatch.fnmatch(file_in_dir, 'service-*.json.gz')]
return files


Expand All @@ -22,7 +23,7 @@ def service_definition_file(servicename):

boto_service_definition_files()
service_definitions_for_service = fnmatch.filter(boto_service_definition_files(),
"**/" + servicename + "/*/service-*.json")
"**/" + servicename + "/*/service-*.json.gz")

service_definitions_for_service.sort()

Expand All @@ -31,6 +32,6 @@ def service_definition_file(servicename):

def operation_definition(servicename, operationname):
"""Returns the operation definition for a specific service and operation"""
with open(service_definition_file(servicename), encoding="UTF-8") as definition_file:
with gzip.open(service_definition_file(servicename), 'rb') as definition_file:
service_definition = json.loads(definition_file.read())
return service_definition['operations'][operationname]