77from ._version import __package_name__ , __version__
88from .exceptions import ExceptionMap , ScaleException
99
10- SCALE_ENDPOINT = "https://api.scale.com/v1"
10+ SCALE_API_BASE_URL_V1 = "https://api.scale.com/v1"
1111
1212# Parameters for HTTP retry
1313HTTP_TOTAL_RETRIES = 3 # Number of total retries
1919class Api :
2020 """Internal Api reference for handling http operations"""
2121
22- def __init__ (self , api_key , user_agent_extension = None ):
22+ def __init__ (self , api_key , user_agent_extension = None , api_instance_url = None ):
2323 if api_key == "" or api_key is None :
2424 raise ScaleException ("Please provide a valid API Key." )
2525
@@ -33,6 +33,7 @@ def __init__(self, api_key, user_agent_extension=None):
3333 self ._headers_multipart_form_data = {
3434 "User-Agent" : self ._generate_useragent (user_agent_extension ),
3535 }
36+ self .base_api_url = api_instance_url or SCALE_API_BASE_URL_V1
3637
3738 @staticmethod
3839 def _http_request (
@@ -101,7 +102,7 @@ def _api_request(
101102 ):
102103 """Generic HTTP request method with error handling."""
103104
104- url = f"{ SCALE_ENDPOINT } /{ endpoint } "
105+ url = f"{ self . base_api_url } /{ endpoint } "
105106
106107 res = self ._http_request (method , url , headers , auth , params , body , files , data )
107108
0 commit comments