Skip to content

fix(shared): skip user agent on much older botocore versions #2366

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

Merged
merged 1 commit into from
Jun 2, 2023
Merged
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
4 changes: 4 additions & 0 deletions aws_lambda_powertools/shared/user_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ def register_feature_to_resource(resource, feature):

def inject_user_agent():
if inject_header:
# Some older botocore versions doesn't support register_initializer. In those cases, we disable the feature.
if not hasattr(botocore, "register_initializer"):
return

# Customize botocore session to inject Powertools header
# See: https://github.com/boto/botocore/pull/2682
botocore.register_initializer(_initializer_botocore_session)