Skip to content

fix: set User-Agent header to qase-api-client-python/<version>#472

Merged
gibiw merged 2 commits intomainfrom
fix/user-agent-header
Mar 26, 2026
Merged

fix: set User-Agent header to qase-api-client-python/<version>#472
gibiw merged 2 commits intomainfrom
fix/user-agent-header

Conversation

@gibiw
Copy link
Copy Markdown
Contributor

@gibiw gibiw commented Mar 26, 2026

Summary

  • Set User-Agent header to qase-api-client-python/<version> on both V1 and V2 API clients so the Qase backend can correctly classify Python SDK requests via its /qase-api-client[\w-]*/i regex
  • Version is resolved dynamically from host_data['commons'] with importlib.metadata fallback
  • Added 6 tests covering format, substring match, both-clients propagation, dynamic version, fallback, and backend regex compatibility

Changed files

  • qase-python-commons/src/qase/commons/client/api_v2_client.py — added _get_commons_version() helper and User-Agent assignment in _add_client_headers()
  • qase-python-commons/tests/tests_qase_commons/test_user_agent.py — new test file

Test plan

  • All 224 existing tests pass
  • 6 new User-Agent tests pass
  • Verify User-Agent appears in outgoing requests in a real environment

@gibiw gibiw changed the base branch from master to main March 26, 2026 13:03
The Qase backend uses /qase-api-client[\w-]*/i regex to classify SDK
requests by source. The auto-generated API clients defaulted to
'OpenAPI-Generator/1.0.0/python' which does not match.

Update both qase-api-client (V1) and qase-api-v2-client (V2) to set
User-Agent to 'qase-api-client-python/<version>' where version is
resolved dynamically via importlib.metadata.
@gibiw gibiw force-pushed the fix/user-agent-header branch from 51f584c to b8a94c8 Compare March 26, 2026 14:09
@gibiw gibiw merged commit 5186fe1 into main Mar 26, 2026
36 checks passed
@gibiw gibiw deleted the fix/user-agent-header branch March 26, 2026 14:16
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.

1 participant