Build User-Agent header string from the object's properties.
(self)
| 389 | return cp |
| 390 | |
| 391 | def to_string(self): |
| 392 | """ |
| 393 | Build User-Agent header string from the object's properties. |
| 394 | """ |
| 395 | config_ua_override = None |
| 396 | if self._client_config: |
| 397 | if hasattr(self._client_config, '_supplied_user_agent'): |
| 398 | config_ua_override = self._client_config._supplied_user_agent |
| 399 | else: |
| 400 | config_ua_override = self._client_config.user_agent |
| 401 | |
| 402 | if config_ua_override is not None: |
| 403 | return self._build_legacy_ua_string(config_ua_override) |
| 404 | |
| 405 | components = [ |
| 406 | *self._build_sdk_metadata(), |
| 407 | RawStringUserAgentComponent('ua/2.1'), |
| 408 | *self._build_os_metadata(), |
| 409 | *self._build_architecture_metadata(), |
| 410 | *self._build_language_metadata(), |
| 411 | *self._build_execution_env_metadata(), |
| 412 | *self._build_feature_metadata(), |
| 413 | *self._build_config_metadata(), |
| 414 | *self._build_app_id(), |
| 415 | *self._build_extra(), |
| 416 | ] |
| 417 | |
| 418 | return ' '.join( |
| 419 | [comp.to_string() for comp in components if comp.to_string()] |
| 420 | ) |
| 421 | |
| 422 | def _build_sdk_metadata(self): |
| 423 | """ |