2323
2424
2525DEFAULT_PORT = 16038
26+ LIGHTING_V1 = "/api/v1/lighting"
2627
2728
2829class SignalRGBException (Exception ):
@@ -161,7 +162,7 @@ def get_effects(self) -> List[Effect]:
161162 >>> print(f"Found {len(effects)} effects")
162163 """
163164 try :
164- response_data = self ._request ("GET" , "/api/v1/lighting /effects" )
165+ response_data = self ._request ("GET" , f" { LIGHTING_V1 } /effects" )
165166 response = EffectListResponse .from_dict (response_data )
166167 self ._ensure_response_ok (response )
167168 effects = response .data
@@ -194,9 +195,7 @@ def get_effect(self, effect_id: str) -> Effect:
194195 >>> print(f"Effect name: {effect.attributes.name}")
195196 """
196197 try :
197- response_data = self ._request (
198- "GET" , f"/api/v1/lighting/effects/{ effect_id } "
199- )
198+ response_data = self ._request ("GET" , f"{ LIGHTING_V1 } /effects/{ effect_id } " )
200199 response = EffectDetailsResponse .from_dict (response_data )
201200 self ._ensure_response_ok (response )
202201 if response .data is None :
@@ -260,7 +259,7 @@ def get_current_effect(self) -> Effect:
260259 >>> print(f"Current effect: {current_effect.attributes.name}")
261260 """
262261 try :
263- response_data = self ._request ("GET" , "/api/v1/lighting " )
262+ response_data = self ._request ("GET" , f" { LIGHTING_V1 } " )
264263 response = EffectDetailsResponse .from_dict (response_data )
265264 self ._ensure_response_ok (response )
266265 if response .data is None :
@@ -287,7 +286,9 @@ def apply_effect(self, effect_id: str) -> None:
287286 >>> print("Effect applied successfully")
288287 """
289288 try :
290- response_data = self ._request ("POST" , f"/api/v1/effects/{ effect_id } /apply" )
289+ response_data = self ._request (
290+ "POST" , f"{ LIGHTING_V1 } /effects/{ effect_id } /apply"
291+ )
291292 response = SignalRGBResponse .from_dict (response_data )
292293 self ._ensure_response_ok (response )
293294 except APIError as e :
0 commit comments