beetkeeper-api-client 0.12.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. beetkeeper_api_client/__init__.py +112 -0
  2. beetkeeper_api_client/_scm_version.py +1 -0
  3. beetkeeper_api_client/api/__init__.py +9 -0
  4. beetkeeper_api_client/api/authentication_api.py +758 -0
  5. beetkeeper_api_client/api/events_api.py +1663 -0
  6. beetkeeper_api_client/api/imports_api.py +3134 -0
  7. beetkeeper_api_client/api/monitoring_api.py +377 -0
  8. beetkeeper_api_client/api/query_api.py +1250 -0
  9. beetkeeper_api_client/api_client.py +845 -0
  10. beetkeeper_api_client/api_response.py +21 -0
  11. beetkeeper_api_client/configuration.py +604 -0
  12. beetkeeper_api_client/exceptions.py +218 -0
  13. beetkeeper_api_client/models/__init__.py +44 -0
  14. beetkeeper_api_client/models/api_album.py +285 -0
  15. beetkeeper_api_client/models/api_track.py +528 -0
  16. beetkeeper_api_client/models/beets_event_type.py +40 -0
  17. beetkeeper_api_client/models/clean_slate_preview.py +147 -0
  18. beetkeeper_api_client/models/clean_slate_submit_request.py +116 -0
  19. beetkeeper_api_client/models/current_beets_subject_state.py +140 -0
  20. beetkeeper_api_client/models/decision_request.py +104 -0
  21. beetkeeper_api_client/models/event_search_response.py +97 -0
  22. beetkeeper_api_client/models/event_search_result.py +107 -0
  23. beetkeeper_api_client/models/event_subject_summary.py +100 -0
  24. beetkeeper_api_client/models/events_list_response.py +95 -0
  25. beetkeeper_api_client/models/find_missing_source_path_request.py +100 -0
  26. beetkeeper_api_client/models/find_missing_source_path_response.py +108 -0
  27. beetkeeper_api_client/models/health_info.py +101 -0
  28. beetkeeper_api_client/models/http_validation_error.py +95 -0
  29. beetkeeper_api_client/models/import_action.py +38 -0
  30. beetkeeper_api_client/models/import_candidate.py +171 -0
  31. beetkeeper_api_client/models/import_decision.py +96 -0
  32. beetkeeper_api_client/models/import_job.py +162 -0
  33. beetkeeper_api_client/models/import_job_status.py +41 -0
  34. beetkeeper_api_client/models/import_submit_request.py +104 -0
  35. beetkeeper_api_client/models/listener_event_details.py +121 -0
  36. beetkeeper_api_client/models/location_inner.py +138 -0
  37. beetkeeper_api_client/models/login_request_body.py +90 -0
  38. beetkeeper_api_client/models/login_response_body.py +100 -0
  39. beetkeeper_api_client/models/logout_response_body.py +88 -0
  40. beetkeeper_api_client/models/search_missing_source_path_result.py +106 -0
  41. beetkeeper_api_client/models/validation_error.py +108 -0
  42. beetkeeper_api_client/py.typed +0 -0
  43. beetkeeper_api_client/rest.py +201 -0
  44. beetkeeper_api_client/sync_helper.py +57 -0
  45. beetkeeper_api_client-0.12.0.dist-info/METADATA +34 -0
  46. beetkeeper_api_client-0.12.0.dist-info/RECORD +48 -0
  47. beetkeeper_api_client-0.12.0.dist-info/WHEEL +5 -0
  48. beetkeeper_api_client-0.12.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,21 @@
1
+ """API response object."""
2
+
3
+ from __future__ import annotations
4
+ from typing import Optional, Generic, Mapping, TypeVar
5
+ from pydantic import Field, StrictInt, StrictBytes, BaseModel
6
+
7
+ T = TypeVar("T")
8
+
9
+ class ApiResponse(BaseModel, Generic[T]):
10
+ """
11
+ API response object
12
+ """
13
+
14
+ status_code: StrictInt = Field(description="HTTP status code")
15
+ headers: Optional[Mapping[str, str]] = Field(None, description="HTTP headers")
16
+ data: T = Field(description="Deserialized data given the data type")
17
+ raw_data: StrictBytes = Field(description="Raw data (HTTP response body)")
18
+
19
+ model_config = {
20
+ "arbitrary_types_allowed": True
21
+ }
@@ -0,0 +1,604 @@
1
+ """
2
+ beetkeeper
3
+
4
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document:
7
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
8
+
9
+ Do not edit the class manually.
10
+ """ # noqa: E501
11
+
12
+
13
+ import base64
14
+ import copy
15
+ import http.client as httplib
16
+ import logging
17
+ from logging import FileHandler
18
+ import sys
19
+ from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict, Union
20
+ from typing_extensions import NotRequired, Self
21
+
22
+
23
+
24
+ JSON_SCHEMA_VALIDATION_KEYWORDS = {
25
+ 'multipleOf', 'maximum', 'exclusiveMaximum',
26
+ 'minimum', 'exclusiveMinimum', 'maxLength',
27
+ 'minLength', 'pattern', 'maxItems', 'minItems'
28
+ }
29
+
30
+ ServerVariablesT = Dict[str, str]
31
+
32
+ GenericAuthSetting = TypedDict(
33
+ "GenericAuthSetting",
34
+ {
35
+ "type": str,
36
+ "in": str,
37
+ "key": str,
38
+ "value": str,
39
+ },
40
+ )
41
+
42
+
43
+ OAuth2AuthSetting = TypedDict(
44
+ "OAuth2AuthSetting",
45
+ {
46
+ "type": Literal["oauth2"],
47
+ "in": Literal["header"],
48
+ "key": Literal["Authorization"],
49
+ "value": str,
50
+ },
51
+ )
52
+
53
+
54
+ APIKeyAuthSetting = TypedDict(
55
+ "APIKeyAuthSetting",
56
+ {
57
+ "type": Literal["api_key"],
58
+ "in": str,
59
+ "key": str,
60
+ "value": Optional[str],
61
+ },
62
+ )
63
+
64
+
65
+ BasicAuthSetting = TypedDict(
66
+ "BasicAuthSetting",
67
+ {
68
+ "type": Literal["basic"],
69
+ "in": Literal["header"],
70
+ "key": Literal["Authorization"],
71
+ "value": Optional[str],
72
+ },
73
+ )
74
+
75
+
76
+ BearerFormatAuthSetting = TypedDict(
77
+ "BearerFormatAuthSetting",
78
+ {
79
+ "type": Literal["bearer"],
80
+ "in": Literal["header"],
81
+ "format": Literal["JWT"],
82
+ "key": Literal["Authorization"],
83
+ "value": str,
84
+ },
85
+ )
86
+
87
+
88
+ BearerAuthSetting = TypedDict(
89
+ "BearerAuthSetting",
90
+ {
91
+ "type": Literal["bearer"],
92
+ "in": Literal["header"],
93
+ "key": Literal["Authorization"],
94
+ "value": str,
95
+ },
96
+ )
97
+
98
+
99
+ HTTPSignatureAuthSetting = TypedDict(
100
+ "HTTPSignatureAuthSetting",
101
+ {
102
+ "type": Literal["http-signature"],
103
+ "in": Literal["header"],
104
+ "key": Literal["Authorization"],
105
+ "value": None,
106
+ },
107
+ )
108
+
109
+
110
+ AuthSettings = TypedDict(
111
+ "AuthSettings",
112
+ {
113
+ "HTTPBearer": BearerAuthSetting,
114
+ },
115
+ total=False,
116
+ )
117
+
118
+
119
+ class HostSettingVariable(TypedDict):
120
+ description: str
121
+ default_value: str
122
+ enum_values: List[str]
123
+
124
+
125
+ class HostSetting(TypedDict):
126
+ url: str
127
+ description: str
128
+ variables: NotRequired[Dict[str, HostSettingVariable]]
129
+
130
+
131
+ class Configuration:
132
+ """This class contains various settings of the API client.
133
+
134
+ :param host: Base url.
135
+ :param ignore_operation_servers
136
+ Boolean to ignore operation servers for the API client.
137
+ Config will use `host` as the base url regardless of the operation servers.
138
+ :param api_key: Dict to store API key(s).
139
+ Each entry in the dict specifies an API key.
140
+ The dict key is the name of the security scheme in the OAS specification.
141
+ The dict value is the API key secret.
142
+ :param api_key_prefix: Dict to store API prefix (e.g. Bearer).
143
+ The dict key is the name of the security scheme in the OAS specification.
144
+ The dict value is an API key prefix when generating the auth data.
145
+ :param username: Username for HTTP basic authentication.
146
+ :param password: Password for HTTP basic authentication.
147
+ :param access_token: Access token.
148
+ :param server_index: Index to servers configuration.
149
+ :param server_variables: Mapping with string values to replace variables in
150
+ templated server configuration. The validation of enums is performed for
151
+ variables with defined enum values before.
152
+ :param server_operation_index: Mapping from operation ID to an index to server
153
+ configuration.
154
+ :param server_operation_variables: Mapping from operation ID to a mapping with
155
+ string values to replace variables in templated server configuration.
156
+ The validation of enums is performed for variables with defined enum
157
+ values before.
158
+ :param verify_ssl: bool - Set this to false to skip verifying SSL certificate
159
+ when calling API from https server.
160
+ :param ssl_ca_cert: str - the path to a file of concatenated CA certificates
161
+ in PEM format.
162
+ :param retries: int - Retry configuration.
163
+ :param ca_cert_data: verify the peer using concatenated CA certificate data
164
+ in PEM (str) or DER (bytes) format.
165
+ :param cert_file: the path to a client certificate file, for mTLS.
166
+ :param key_file: the path to a client key file, for mTLS.
167
+ :param assert_hostname: Set this to True/False to enable/disable SSL hostname verification.
168
+ :param tls_server_name: SSL/TLS Server Name Indication (SNI). Set this to the SNI value expected by the server.
169
+ :param connection_pool_maxsize: Connection pool max size. None in the constructor is coerced to 100 for async and cpu_count * 5 for sync.
170
+ :param proxy: Proxy URL.
171
+ :param proxy_headers: Proxy headers.
172
+ :param safe_chars_for_path_param: Safe characters for path parameter encoding.
173
+ :param client_side_validation: Enable client-side validation. Default True.
174
+ :param socket_options: Options to pass down to the underlying urllib3 socket.
175
+ :param datetime_format: Datetime format string for serialization.
176
+ :param date_format: Date format string for serialization.
177
+
178
+ :Example:
179
+ """
180
+
181
+ _default: ClassVar[Optional[Self]] = None
182
+
183
+ def __init__(
184
+ self,
185
+ host: Optional[str]=None,
186
+ api_key: Optional[Dict[str, str]]=None,
187
+ api_key_prefix: Optional[Dict[str, str]]=None,
188
+ username: Optional[str]=None,
189
+ password: Optional[str]=None,
190
+ access_token: Optional[str]=None,
191
+ server_index: Optional[int]=None,
192
+ server_variables: Optional[ServerVariablesT]=None,
193
+ server_operation_index: Optional[Dict[int, int]]=None,
194
+ server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None,
195
+ ignore_operation_servers: bool=False,
196
+ ssl_ca_cert: Optional[str]=None,
197
+ retries: Optional[int] = None,
198
+ ca_cert_data: Optional[Union[str, bytes]] = None,
199
+ cert_file: Optional[str]=None,
200
+ key_file: Optional[str]=None,
201
+ verify_ssl: bool=True,
202
+ assert_hostname: Optional[bool]=None,
203
+ tls_server_name: Optional[str]=None,
204
+ connection_pool_maxsize: Optional[int]=None,
205
+ proxy: Optional[str]=None,
206
+ proxy_headers: Optional[Any]=None,
207
+ safe_chars_for_path_param: str='',
208
+ client_side_validation: bool=True,
209
+ socket_options: Optional[Any]=None,
210
+ datetime_format: str="%Y-%m-%dT%H:%M:%S.%f%z",
211
+ date_format: str="%Y-%m-%d",
212
+ *,
213
+ debug: Optional[bool] = None,
214
+ ) -> None:
215
+ """Constructor
216
+ """
217
+ self._base_path = "http://localhost" if host is None else host
218
+ """Default Base url
219
+ """
220
+ self.server_index = 0 if server_index is None and host is None else server_index
221
+ self.server_operation_index = server_operation_index or {}
222
+ """Default server index
223
+ """
224
+ self.server_variables = server_variables or {}
225
+ self.server_operation_variables = server_operation_variables or {}
226
+ """Default server variables
227
+ """
228
+ self.ignore_operation_servers = ignore_operation_servers
229
+ """Ignore operation servers
230
+ """
231
+ self.temp_folder_path = None
232
+ """Temp file folder for downloading files
233
+ """
234
+ # Authentication Settings
235
+ self.api_key = {}
236
+ if api_key:
237
+ self.api_key = api_key
238
+ """dict to store API key(s)
239
+ """
240
+ self.api_key_prefix = {}
241
+ if api_key_prefix:
242
+ self.api_key_prefix = api_key_prefix
243
+ """dict to store API prefix (e.g. Bearer)
244
+ """
245
+ self.refresh_api_key_hook = None
246
+ """function hook to refresh API key if expired
247
+ """
248
+ self.username = username
249
+ """Username for HTTP basic authentication
250
+ """
251
+ self.password = password
252
+ """Password for HTTP basic authentication
253
+ """
254
+ self.access_token = access_token
255
+ """Access token
256
+ """
257
+ self.logger = {}
258
+ """Logging Settings
259
+ """
260
+ self.logger["package_logger"] = logging.getLogger("beetkeeper_api_client")
261
+ self.logger_format = '%(asctime)s %(levelname)s %(message)s'
262
+ """Log format
263
+ """
264
+ self.logger_stream_handler = None
265
+ """Log stream handler
266
+ """
267
+ self.logger_file_handler: Optional[FileHandler] = None
268
+ """Log file handler
269
+ """
270
+ self.logger_file = None
271
+ """Debug file location
272
+ """
273
+ if debug is not None:
274
+ self.debug = debug
275
+ else:
276
+ self.__debug = False
277
+ """Debug switch
278
+ """
279
+
280
+ self.verify_ssl = verify_ssl
281
+ """SSL/TLS verification
282
+ Set this to false to skip verifying SSL certificate when calling API
283
+ from https server.
284
+ """
285
+ self.ssl_ca_cert = ssl_ca_cert
286
+ """Set this to customize the certificate file to verify the peer.
287
+ """
288
+ self.ca_cert_data = ca_cert_data
289
+ """Set this to verify the peer using PEM (str) or DER (bytes)
290
+ certificate data.
291
+ """
292
+ self.cert_file = cert_file
293
+ """client certificate file
294
+ """
295
+ self.key_file = key_file
296
+ """client key file
297
+ """
298
+ self.assert_hostname = assert_hostname
299
+ """Set this to True/False to enable/disable SSL hostname verification.
300
+ """
301
+ self.tls_server_name = tls_server_name
302
+ """SSL/TLS Server Name Indication (SNI)
303
+ Set this to the SNI value expected by the server.
304
+ """
305
+
306
+ self.connection_pool_maxsize = connection_pool_maxsize if connection_pool_maxsize is not None else 100
307
+ """This value is passed to the aiohttp to limit simultaneous connections.
308
+ None in the constructor is coerced to default 100.
309
+ """
310
+
311
+ self.proxy = proxy
312
+ """Proxy URL
313
+ """
314
+ self.proxy_headers = proxy_headers
315
+ """Proxy headers
316
+ """
317
+ self.safe_chars_for_path_param = safe_chars_for_path_param
318
+ """Safe chars for path_param
319
+ """
320
+ self.retries = retries
321
+ """Retry configuration
322
+ """
323
+ # Enable client side validation
324
+ self.client_side_validation = client_side_validation
325
+
326
+ self.socket_options = socket_options
327
+ """Options to pass down to the underlying urllib3 socket
328
+ """
329
+
330
+ self.datetime_format = datetime_format
331
+ """datetime format
332
+ """
333
+
334
+ self.date_format = date_format
335
+ """date format
336
+ """
337
+
338
+ def __deepcopy__(self, memo: Dict[int, Any]) -> Self:
339
+ cls = self.__class__
340
+ result = cls.__new__(cls)
341
+ memo[id(self)] = result
342
+ for k, v in self.__dict__.items():
343
+ if k not in ('logger', 'logger_file_handler'):
344
+ setattr(result, k, copy.deepcopy(v, memo))
345
+ # shallow copy of loggers
346
+ result.logger = copy.copy(self.logger)
347
+ # use setter to re-create the file handler (excluded from __dict__ copy)
348
+ result.logger_file = self.logger_file
349
+
350
+ return result
351
+
352
+ def __setattr__(self, name: str, value: Any) -> None:
353
+ object.__setattr__(self, name, value)
354
+
355
+ @classmethod
356
+ def set_default(cls, default: Optional[Self]) -> None:
357
+ """Set default instance of configuration.
358
+
359
+ It stores default configuration, which can be
360
+ returned by get_default_copy method.
361
+
362
+ :param default: object of Configuration
363
+ """
364
+ cls._default = default
365
+
366
+ @classmethod
367
+ def get_default_copy(cls) -> Self:
368
+ """Deprecated. Please use `get_default` instead.
369
+
370
+ Deprecated. Please use `get_default` instead.
371
+
372
+ :return: The configuration object.
373
+ """
374
+ return cls.get_default()
375
+
376
+ @classmethod
377
+ def get_default(cls) -> Self:
378
+ """Return the default configuration.
379
+
380
+ This method returns newly created, based on default constructor,
381
+ object of Configuration class or returns a copy of default
382
+ configuration.
383
+
384
+ :return: The configuration object.
385
+ """
386
+ if cls._default is None:
387
+ cls._default = cls()
388
+ return cls._default
389
+
390
+ @property
391
+ def logger_file(self) -> Optional[str]:
392
+ """The logger file.
393
+
394
+ If the logger_file is None, then add stream handler and remove file
395
+ handler. Otherwise, add file handler and remove stream handler.
396
+
397
+ :param value: The logger_file path.
398
+ :type: str
399
+ """
400
+ return self.__logger_file
401
+
402
+ @logger_file.setter
403
+ def logger_file(self, value: Optional[str]) -> None:
404
+ """The logger file.
405
+
406
+ If the logger_file is None, then add stream handler and remove file
407
+ handler. Otherwise, add file handler and remove stream handler.
408
+
409
+ :param value: The logger_file path.
410
+ :type: str
411
+ """
412
+ self.__logger_file = value
413
+ if self.__logger_file:
414
+ # If set logging file,
415
+ # then add file handler and remove stream handler.
416
+ self.logger_file_handler = logging.FileHandler(self.__logger_file)
417
+ self.logger_file_handler.setFormatter(self.logger_formatter)
418
+ for _, logger in self.logger.items():
419
+ logger.addHandler(self.logger_file_handler)
420
+
421
+ @property
422
+ def debug(self) -> bool:
423
+ """Debug status
424
+
425
+ :param value: The debug status, True or False.
426
+ :type: bool
427
+ """
428
+ return self.__debug
429
+
430
+ @debug.setter
431
+ def debug(self, value: bool) -> None:
432
+ """Debug status
433
+
434
+ :param value: The debug status, True or False.
435
+ :type: bool
436
+ """
437
+ self.__debug = value
438
+ if self.__debug:
439
+ # if debug status is True, turn on debug logging
440
+ for _, logger in self.logger.items():
441
+ logger.setLevel(logging.DEBUG)
442
+ # turn on httplib debug
443
+ httplib.HTTPConnection.debuglevel = 1
444
+ else:
445
+ # if debug status is False, turn off debug logging,
446
+ # setting log level to default `logging.WARNING`
447
+ for _, logger in self.logger.items():
448
+ logger.setLevel(logging.WARNING)
449
+ # turn off httplib debug
450
+ httplib.HTTPConnection.debuglevel = 0
451
+
452
+ @property
453
+ def logger_format(self) -> str:
454
+ """The logger format.
455
+
456
+ The logger_formatter will be updated when sets logger_format.
457
+
458
+ :param value: The format string.
459
+ :type: str
460
+ """
461
+ return self.__logger_format
462
+
463
+ @logger_format.setter
464
+ def logger_format(self, value: str) -> None:
465
+ """The logger format.
466
+
467
+ The logger_formatter will be updated when sets logger_format.
468
+
469
+ :param value: The format string.
470
+ :type: str
471
+ """
472
+ self.__logger_format = value
473
+ self.logger_formatter = logging.Formatter(self.__logger_format)
474
+
475
+ def get_api_key_with_prefix(self, identifier: str, alias: Optional[str]=None) -> Optional[str]:
476
+ """Gets API key (with prefix if set).
477
+
478
+ :param identifier: The identifier of apiKey.
479
+ :param alias: The alternative identifier of apiKey.
480
+ :return: The token for api key authentication.
481
+ """
482
+ if self.refresh_api_key_hook is not None:
483
+ self.refresh_api_key_hook(self)
484
+ key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None)
485
+ if key:
486
+ prefix = self.api_key_prefix.get(
487
+ identifier, self.api_key_prefix.get(alias) if alias is not None else None)
488
+ if prefix:
489
+ return "%s %s" % (prefix, key)
490
+ else:
491
+ return key
492
+
493
+ return None
494
+
495
+ def get_basic_auth_token(self) -> Optional[str]:
496
+ """Gets HTTP basic authentication header (string).
497
+
498
+ :return: The token for basic HTTP authentication.
499
+ """
500
+ username = ""
501
+ if self.username is not None:
502
+ username = self.username
503
+ password = ""
504
+ if self.password is not None:
505
+ password = self.password
506
+
507
+ return "Basic " + base64.b64encode(
508
+ (username + ":" + password).encode('utf-8')
509
+ ).decode('utf-8')
510
+
511
+ def auth_settings(self)-> AuthSettings:
512
+ """Gets Auth Settings dict for api client.
513
+
514
+ :return: The Auth Settings information dict.
515
+ """
516
+ auth: AuthSettings = {}
517
+ if self.access_token is not None:
518
+ auth['HTTPBearer'] = {
519
+ 'type': 'bearer',
520
+ 'in': 'header',
521
+ 'key': 'Authorization',
522
+ 'value': 'Bearer ' + self.access_token
523
+ }
524
+ return auth
525
+
526
+ def to_debug_report(self) -> str:
527
+ """Gets the essential information for debugging.
528
+
529
+ :return: The report for debugging.
530
+ """
531
+ return "Python SDK Debug Report:\n"\
532
+ "OS: {env}\n"\
533
+ "Python Version: {pyversion}\n"\
534
+ "Version of the API: \n"\
535
+ "SDK Package Version: 0.12.0".\
536
+ format(env=sys.platform, pyversion=sys.version)
537
+
538
+ def get_host_settings(self) -> List[HostSetting]:
539
+ """Gets an array of host settings
540
+
541
+ :return: An array of host settings
542
+ """
543
+ return [
544
+ {
545
+ 'url': "",
546
+ 'description': "No description provided",
547
+ }
548
+ ]
549
+
550
+ def get_host_from_settings(
551
+ self,
552
+ index: Optional[int],
553
+ variables: Optional[ServerVariablesT]=None,
554
+ servers: Optional[List[HostSetting]]=None,
555
+ ) -> str:
556
+ """Gets host URL based on the index and variables
557
+ :param index: array index of the host settings
558
+ :param variables: hash of variable and the corresponding value
559
+ :param servers: an array of host settings or None
560
+ :return: URL based on host settings
561
+ """
562
+ if index is None:
563
+ return self._base_path
564
+
565
+ variables = {} if variables is None else variables
566
+ servers = self.get_host_settings() if servers is None else servers
567
+
568
+ try:
569
+ server = servers[index]
570
+ except IndexError:
571
+ raise ValueError(
572
+ "Invalid index {0} when selecting the host settings. "
573
+ "Must be less than {1}".format(index, len(servers)))
574
+
575
+ url = server['url']
576
+
577
+ # go through variables and replace placeholders
578
+ for variable_name, variable in server.get('variables', {}).items():
579
+ used_value = variables.get(
580
+ variable_name, variable['default_value'])
581
+
582
+ if 'enum_values' in variable \
583
+ and variable['enum_values'] \
584
+ and used_value not in variable['enum_values']:
585
+ raise ValueError(
586
+ "The variable `{0}` in the host URL has invalid value "
587
+ "{1}. Must be {2}.".format(
588
+ variable_name, variables[variable_name],
589
+ variable['enum_values']))
590
+
591
+ url = url.replace("{" + variable_name + "}", used_value)
592
+
593
+ return url
594
+
595
+ @property
596
+ def host(self) -> str:
597
+ """Return generated host."""
598
+ return self.get_host_from_settings(self.server_index, variables=self.server_variables)
599
+
600
+ @host.setter
601
+ def host(self, value: str) -> None:
602
+ """Fix base path."""
603
+ self._base_path = value
604
+ self.server_index = None