@@ -19,6 +19,10 @@ def __init__(self, client_id=None, log_level=0, tls=True, rest_host=None, realti
1919
2020 super ().__init__ (** kwargs )
2121
22+ if endpoint is not None :
23+ if environment is not None or rest_host is not None or realtime_host is not None :
24+ raise ValueError ('endpoint is incompatible with any of environment, rest_host or realtime_host' )
25+
2226 # TODO check these defaults
2327 if fallback_retry_timeout is None :
2428 fallback_retry_timeout = Defaults .fallback_retry_timeout
@@ -43,16 +47,10 @@ def __init__(self, client_id=None, log_level=0, tls=True, rest_host=None, realti
4347 if environment is not None and realtime_host is not None :
4448 raise ValueError ('specify realtime_host or environment, not both' )
4549
46- if environment is not None and endpoint is not None :
47- raise ValueError ('specify endpoint or environment, not both' )
48-
4950 if idempotent_rest_publishing is None :
5051 from ably import api_version
5152 idempotent_rest_publishing = api_version >= '1.2'
5253
53- if environment == "production" :
54- endpoint = Defaults .endpoint
55-
5654 if environment is not None and endpoint is None :
5755 endpoint = environment
5856
@@ -287,7 +285,7 @@ def __get_rest_hosts(self):
287285 # Fallback hosts
288286 fallback_hosts = self .fallback_hosts
289287 if fallback_hosts is None :
290- if self .rest_host :
288+ if self .rest_host is not None :
291289 fallback_hosts = []
292290 else :
293291 fallback_hosts = Defaults .get_fallback_hosts (self .endpoint )
0 commit comments