Skip to content

Commit cfb8d76

Browse files
committed
remove endpoint option
1 parent e2bd517 commit cfb8d76

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

scaleapi/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
'fields', 'choices'},
1414
'annotation': {'attachment', 'attachment_type', 'instruction',
1515
'objects_to_annotate', 'with_labels'}}
16+
SCALE_ENDPOINT = 'https://api.scaleapi.com/v1/'
1617

1718

1819
def validate_payload(task_type, kwargs):
@@ -34,9 +35,8 @@ class ScaleInvalidRequest(ScaleException, ValueError):
3435

3536

3637
class ScaleClient(object):
37-
def __init__(self, api_key, endpoint='https://api.scaleapi.com/v1/'):
38+
def __init__(self, api_key):
3839
self.api_key = api_key
39-
self.endpoint = endpoint
4040

4141
def _getrequest(self, endpoint, params={}):
4242
"""Makes a get request to an endpoint.
@@ -45,7 +45,7 @@ def _getrequest(self, endpoint, params={}):
4545
{ 'status_code': XXX,
4646
'error': 'I failed' }
4747
"""
48-
r = requests.get(self.endpoint + endpoint,
48+
r = requests.get(SCALE_ENDPOINT + endpoint,
4949
headers={"Content-Type": "application/json"},
5050
auth=(self.api_key, ''), params=params)
5151

@@ -61,7 +61,7 @@ def _postrequest(self, endpoint, payload=None):
6161
'error': 'I failed' }
6262
"""
6363
payload = payload or {}
64-
r = requests.post(self.endpoint + endpoint, json=payload,
64+
r = requests.post(SCALE_ENDPOINT + endpoint, json=payload,
6565
headers={"Content-Type": "application/json"},
6666
auth=(self.api_key, ''))
6767

0 commit comments

Comments
 (0)