Return a string suitable for use as a User-Agent header. The string will be of the form: / Python/ / Where: - agent_name is the value of the `user_agent_name` attribute of the s
(self, truncate=False)
| 498 | return self._auth_token |
| 499 | |
| 500 | def user_agent(self, truncate=False): |
| 501 | """ |
| 502 | Return a string suitable for use as a User-Agent header. |
| 503 | The string will be of the form: |
| 504 | |
| 505 | <agent_name>/<agent_version> Python/<py_ver> <plat_name>/<plat_ver> <exec_env> |
| 506 | |
| 507 | Where: |
| 508 | |
| 509 | - agent_name is the value of the `user_agent_name` attribute |
| 510 | of the session object (`Botocore` by default). |
| 511 | - agent_version is the value of the `user_agent_version` |
| 512 | attribute of the session object (the botocore version by default). |
| 513 | by default. |
| 514 | - py_ver is the version of the Python interpreter beng used. |
| 515 | - plat_name is the name of the platform (e.g. Darwin) |
| 516 | - plat_ver is the version of the platform |
| 517 | - exec_env is exec-env/$AWS_EXECUTION_ENV |
| 518 | |
| 519 | If ``user_agent_extra`` is not empty, then this value will be |
| 520 | appended to the end of the user agent string. |
| 521 | |
| 522 | If ``truncate`` is True we return only agent_name and agent_version |
| 523 | it can be done for security reasons |
| 524 | |
| 525 | """ |
| 526 | if truncate: |
| 527 | return f'{self.user_agent_name}/{self.user_agent_version}' |
| 528 | base = f'{self.user_agent_name}/{self.user_agent_version} Python/{platform.python_version()} {platform.system()}/{platform.release()}' |
| 529 | if os.environ.get('AWS_EXECUTION_ENV') is not None: |
| 530 | base += ' exec-env/{}'.format(os.environ.get('AWS_EXECUTION_ENV')) |
| 531 | if self.user_agent_extra: |
| 532 | base += f' {self.user_agent_extra}' |
| 533 | |
| 534 | return base |
| 535 | |
| 536 | def get_data(self, data_path): |
| 537 | """ |
no test coverage detected