13
13
'fields' , 'choices' },
14
14
'annotation' : {'attachment' , 'attachment_type' , 'instruction' ,
15
15
'objects_to_annotate' , 'with_labels' }}
16
+ SCALE_ENDPOINT = 'https://api.scaleapi.com/v1/'
16
17
17
18
18
19
def validate_payload (task_type , kwargs ):
@@ -34,9 +35,8 @@ class ScaleInvalidRequest(ScaleException, ValueError):
34
35
35
36
36
37
class ScaleClient (object ):
37
- def __init__ (self , api_key , endpoint = 'https://api.scaleapi.com/v1/' ):
38
+ def __init__ (self , api_key ):
38
39
self .api_key = api_key
39
- self .endpoint = endpoint
40
40
41
41
def _getrequest (self , endpoint , params = {}):
42
42
"""Makes a get request to an endpoint.
@@ -45,7 +45,7 @@ def _getrequest(self, endpoint, params={}):
45
45
{ 'status_code': XXX,
46
46
'error': 'I failed' }
47
47
"""
48
- r = requests .get (self . endpoint + endpoint ,
48
+ r = requests .get (SCALE_ENDPOINT + endpoint ,
49
49
headers = {"Content-Type" : "application/json" },
50
50
auth = (self .api_key , '' ), params = params )
51
51
@@ -61,7 +61,7 @@ def _postrequest(self, endpoint, payload=None):
61
61
'error': 'I failed' }
62
62
"""
63
63
payload = payload or {}
64
- r = requests .post (self . endpoint + endpoint , json = payload ,
64
+ r = requests .post (SCALE_ENDPOINT + endpoint , json = payload ,
65
65
headers = {"Content-Type" : "application/json" },
66
66
auth = (self .api_key , '' ))
67
67
0 commit comments