Skip to content

Commit e7f34a4

Browse files
committed
convert the boolean to lowercase string in query param
1 parent 7caed6f commit e7f34a4

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

datacrunch/instances/instances.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ def action(self, id_list: Union[List[str], str], action: str, volume_ids: Option
427427
return
428428

429429
# TODO: use enum/const for location_code
430-
def is_available(self, instance_type: str, is_spot: bool = None, location_code: str = Locations.FIN_01) -> bool:
430+
def is_available(self, instance_type: str, is_spot: bool = None, location_code: str = None) -> bool:
431431
"""Returns True if a specific instance type is now available for deployment
432432
433433
:param instance_type: instance type
@@ -439,12 +439,13 @@ def is_available(self, instance_type: str, is_spot: bool = None, location_code:
439439
:return: True if available to deploy, False otherwise
440440
:rtype: bool
441441
"""
442+
is_spot = str(is_spot).lower() if is_spot is not None else None
442443
query_params = {'isSpot': is_spot, 'location_code': location_code}
443444
url = f'/instance-availability/{instance_type}'
444445
return self._http_client.get(url, query_params).json()
445446

446447
# TODO: use enum/const for location_code
447-
def get_availabilities(self, is_spot: bool = None, location_code: str = Locations.FIN_01) -> bool:
448+
def get_availabilities(self, is_spot: bool = None, location_code: str = None) -> bool:
448449
"""Returns a list of available instance types
449450
450451
:param is_spot: Is spot instance
@@ -454,5 +455,6 @@ def get_availabilities(self, is_spot: bool = None, location_code: str = Location
454455
:return: list of available instance types in every location
455456
:rtype: list
456457
"""
458+
is_spot = str(is_spot).lower() if is_spot is not None else None
457459
query_params = {'isSpot': is_spot, 'location_code': location_code}
458460
return self._http_client.get('/instance-availability', params=query_params).json()

0 commit comments

Comments
 (0)