@@ -37,7 +37,8 @@ class Client:
3737
3838 def __init__ (self ,
3939 api_key = None ,
40- endpoint = 'https://api.labelbox.com/graphql' ):
40+ endpoint = 'https://api.labelbox.com/graphql' ,
41+ enable_beta = False ):
4142 """ Creates and initializes a Labelbox Client.
4243
4344 Logging is defaulted to level WARNING. To receive more verbose
@@ -50,6 +51,7 @@ def __init__(self,
5051 Args:
5152 api_key (str): API key. If None, the key is obtained from the "LABELBOX_API_KEY" environment variable.
5253 endpoint (str): URL of the Labelbox server to connect to.
54+ enable_beta (bool): Indicated whether or not to use beta features
5355 Raises:
5456 labelbox.exceptions.AuthenticationError: If no `api_key`
5557 is provided as an argument or via the environment
@@ -61,6 +63,10 @@ def __init__(self,
6163 "Labelbox API key not provided" )
6264 api_key = os .environ [_LABELBOX_API_KEY ]
6365 self .api_key = api_key
66+ self .enable_beta = enable_beta
67+
68+ if enable_beta :
69+ logger .info ("Beta features have been enabled" )
6470
6571 logger .info ("Initializing Labelbox client at '%s'" , endpoint )
6672
@@ -74,7 +80,7 @@ def __init__(self,
7480
7581 @retry .Retry (predicate = retry .if_exception_type (
7682 labelbox .exceptions .InternalServerError ))
77- def execute (self , query , params = None , timeout = 30.0 , experimental = False ):
83+ def execute (self , query , params = None , timeout = 30.0 ):
7884 """ Sends a request to the server for the execution of the
7985 given query.
8086
@@ -86,8 +92,6 @@ def execute(self, query, params=None, timeout=30.0, experimental=False):
8692 params (dict): Query parameters referenced within the query.
8793 timeout (float): Max allowed time for query execution,
8894 in seconds.
89- experimental (bool): Enables users to query experimental features.
90- Users should be aware that these features could change slightly over time.
9195 Returns:
9296 dict, parsed JSON response.
9397 Raises:
@@ -122,15 +126,7 @@ def convert_value(value):
122126 data = json .dumps ({'query' : query , 'variables' : params }).encode ('utf-8' )
123127
124128 try :
125- endpoint = self .endpoint
126-
127- if experimental :
128- endpoint = self .endpoint .replace ('graphql' , '_gql' )
129- logger .info (
130- "Experimental queries/mutations aren't guarenteed to maintain their interface."
131- )
132-
133- response = requests .post (endpoint ,
129+ response = requests .post (self .endpoint ,
134130 data = data ,
135131 headers = self .headers ,
136132 timeout = timeout )
0 commit comments