@@ -19,6 +19,10 @@ def __init__(self, client_id=None, log_level=0, tls=True, rest_host=None, realti
19
19
20
20
super ().__init__ (** kwargs )
21
21
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
+
22
26
# TODO check these defaults
23
27
if fallback_retry_timeout is None :
24
28
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
43
47
if environment is not None and realtime_host is not None :
44
48
raise ValueError ('specify realtime_host or environment, not both' )
45
49
46
- if environment is not None and endpoint is not None :
47
- raise ValueError ('specify endpoint or environment, not both' )
48
-
49
50
if idempotent_rest_publishing is None :
50
51
from ably import api_version
51
52
idempotent_rest_publishing = api_version >= '1.2'
52
53
53
- if environment == "production" :
54
- endpoint = Defaults .endpoint
55
-
56
54
if environment is not None and endpoint is None :
57
55
endpoint = environment
58
56
@@ -287,7 +285,7 @@ def __get_rest_hosts(self):
287
285
# Fallback hosts
288
286
fallback_hosts = self .fallback_hosts
289
287
if fallback_hosts is None :
290
- if self .rest_host :
288
+ if self .rest_host is not None :
291
289
fallback_hosts = []
292
290
else :
293
291
fallback_hosts = Defaults .get_fallback_hosts (self .endpoint )
0 commit comments