Configures the max size of a built user agent string component and the delimiter used to truncate the string if the size is above the max.
| 157 | |
| 158 | |
| 159 | class UserAgentComponentSizeConfig: |
| 160 | """ |
| 161 | Configures the max size of a built user agent string component and the |
| 162 | delimiter used to truncate the string if the size is above the max. |
| 163 | """ |
| 164 | |
| 165 | def __init__(self, max_size_in_bytes: int, delimiter: str): |
| 166 | self.max_size_in_bytes = max_size_in_bytes |
| 167 | self.delimiter = delimiter |
| 168 | self._validate_input() |
| 169 | |
| 170 | def _validate_input(self): |
| 171 | if self.max_size_in_bytes < 1: |
| 172 | raise ValueError( |
| 173 | f'Invalid `max_size_in_bytes`: {self.max_size_in_bytes}. ' |
| 174 | 'Value must be a positive integer.' |
| 175 | ) |
| 176 | |
| 177 | |
| 178 | class UserAgentComponent(NamedTuple): |
no outgoing calls