@@ -118,7 +118,7 @@ class ConnectionError(Exception):
118118class AuthorizationError (ConnectionError ):
119119 """Indicates an issue with the team credentials"""
120120
121- class CubeServerConfig :
121+ class ConnectionConfig :
122122 """The configuration of the connection to the server"""
123123 TIMEOUT : int = 60
124124 if 'client_config' in globals ():
@@ -132,7 +132,7 @@ class CubeServerConfig:
132132 API_HOST : str = "https://api.local"
133133 API_PORT : int = 8081
134134
135- CUBESERVER_DEFAULT_CONFIG = CubeServerConfig ()
135+ CUBESERVER_DEFAULT_CONFIG = ConnectionConfig ()
136136
137137GameStatus = namedtuple ("GameStatus" ,
138138 ['unix_time' ,
@@ -150,7 +150,7 @@ def _if_conf_exists(key: str):
150150 return None
151151 return getattr (client_config , key )
152152
153- class CubeServer :
153+ class Connection :
154154 """A class for connecting to the server"""
155155
156156 def __init__ (
@@ -159,14 +159,16 @@ def __init__(
159159 team_secret : str = _if_conf_exists ('TEAM_SECRET' ),
160160 server_cert : str = _if_conf_exists ('SERVER_CERT' ),
161161 conf = CUBESERVER_DEFAULT_CONFIG ,
162- verbose : bool = False
162+ verbose : bool = False ,
163+ _force : bool = False
163164 ):
164165 """Initializes the connection to the server"""
165166 # Check parameters:
166- if team_name is None or \
167+ if not _force and \
168+ team_name is None or \
167169 team_secret is None or \
168170 server_cert is None or \
169- not isinstance (conf , CubeServerConfig ):
171+ not isinstance (conf , ConnectionConfig ):
170172 raise TypeError ("Bad parameters or client config" )
171173 self .team_name = team_name
172174 self .team_secret = team_secret
@@ -234,6 +236,9 @@ def _do_request(
234236 content_type : str = None ,
235237 headers : list [str ] = []
236238 ) -> str :
239+ if self .team_name is None :
240+ raise TypeError ("This connection instance is not configured properly for making REST requests." )
241+
237242 if self .v :
238243 print (f"Making { method } request to { path } ..." )
239244
0 commit comments