Skip to content

Conversation

@jonathan343
Copy link
Contributor

Summary

This PR allows hash characters (#) in the user_agent_appid configuration value.

Changes

  • Updated the user_agent_appid sanitization logic in botocore/useragent.py to preserve hash characters when building the User-Agent string.
  • Modified documentation in botocore/config.py to reflect that # is now an allowed character alongside the existing allowed set.
  • Added unit test test_hash_in_user_agent_appid in tests/unit/test_useragent.py to verify the behavior

Before

When setting user_agent_appid='fooapp#1.0.0', the hash character would be sanitized and replaced with a dash:

User-Agent: Botocore/1.40.68 ua/2.1 os/linux#1.2.3-foo ... app/fooapp-1.0.0

After

The hash character is now preserved in the user_agent_appid:

User-Agent: Botocore/1.40.68 ua/2.1 os/linux#1.2.3-foo ... app/fooapp#1.0.0

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@jonathan343 jonathan343 changed the title Support # in user_agent_appid Support # in user_agent_appid Nov 7, 2025
@jonathan343 jonathan343 merged commit bfa139f into develop Nov 10, 2025
78 checks passed
@jonathan343 jonathan343 deleted the allow-hash-in-appid branch November 10, 2025 15:53
aws-sdk-python-automation added a commit that referenced this pull request Nov 10, 2025
* release-1.40.70:
  Bumping version to 1.40.70
  Update to latest models
  Support # in user_agent_appid (#3588)
hswong3i pushed a commit to alvistack/boto-botocore that referenced this pull request Nov 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants