Skip to content

Commit 5a41127

Browse files
Check botocore version when activating integration (getsentry#921)
Co-authored-by: Markus Unterwaditzer <markus-honeypot@unterwaditzer.net>
1 parent c6b6f20 commit 5a41127

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

sentry_sdk/integrations/boto3.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from typing import Type
1515

1616
try:
17+
from botocore import __version__ as BOTOCORE_VERSION # type: ignore
1718
from botocore.client import BaseClient # type: ignore
1819
from botocore.response import StreamingBody # type: ignore
1920
from botocore.awsrequest import AWSRequest # type: ignore
@@ -27,6 +28,14 @@ class Boto3Integration(Integration):
2728
@staticmethod
2829
def setup_once():
2930
# type: () -> None
31+
try:
32+
version = tuple(map(int, BOTOCORE_VERSION.split(".")[:3]))
33+
except (ValueError, TypeError):
34+
raise DidNotEnable(
35+
"Unparsable botocore version: {}".format(BOTOCORE_VERSION)
36+
)
37+
if version < (1, 12):
38+
raise DidNotEnable("Botocore 1.12 or newer is required.")
3039
orig_init = BaseClient.__init__
3140

3241
def sentry_patched_init(self, *args, **kwargs):

tox.ini

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ envlist =
8383

8484
{py3.6,py3.7,py3.8}-chalice-{1.16,1.17,1.18,1.19,1.20}
8585

86-
{py2.7,py3.6,py3.7,py3.8}-boto3-{1.14,1.15,1.16}
86+
{py2.7,py3.6,py3.7,py3.8}-boto3-{1.9,1.10,1.11,1.12,1.13,1.14,1.15,1.16}
8787

8888
[testenv]
8989
deps =
@@ -234,6 +234,11 @@ deps =
234234
chalice-1.20: chalice>=1.20.0,<1.21.0
235235
chalice: pytest-chalice==0.0.5
236236

237+
boto3-1.9: boto3>=1.9,<1.10
238+
boto3-1.10: boto3>=1.10,<1.11
239+
boto3-1.11: boto3>=1.11,<1.12
240+
boto3-1.12: boto3>=1.12,<1.13
241+
boto3-1.13: boto3>=1.13,<1.14
237242
boto3-1.14: boto3>=1.14,<1.15
238243
boto3-1.15: boto3>=1.15,<1.16
239244
boto3-1.16: boto3>=1.16,<1.17

0 commit comments

Comments
 (0)