Skip to content

Commit 2b9823b

Browse files
committed
chore(sdk): fix api backwards compatibility
fix api backwards compatibility
1 parent 317dc15 commit 2b9823b

3 files changed

Lines changed: 6 additions & 7 deletions

File tree

staxapp/api.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class Api:
1111
def get_config(cls, config=None):
1212
if config is None:
1313
config = Config.GetDefaultConfig()
14+
config.init()
1415
return config
1516

1617
@classmethod

staxapp/config.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ class Config:
2929
_requests_auth = None
3030
_initialized = False
3131
base_url = None
32-
_hostname = f"api.{STAX_REGION}"
33-
hostname = None
32+
hostname = f"api.{STAX_REGION}"
3433
org_id = None
3534
expiration = None
3635
load_live_schema = True
@@ -62,9 +61,8 @@ def get_api_config(cls, config_url):
6261
return config_response.json()
6362

6463
def __init__(self, hostname=None, access_key=None, secret_key=None):
65-
self.hostname = hostname
66-
if self.hostname is None:
67-
self.hostname = Config._hostname
64+
if hostname is not None:
65+
self.hostname = hostname
6866
self.access_key = access_key
6967
self.secret_key = secret_key
7068

@@ -93,7 +91,7 @@ def branch(cls):
9391

9492
@classmethod
9593
def schema_url(cls):
96-
return f"https://{cls._hostname}/{cls.API_VERSION}/public/api-document"
94+
return f"https://{cls.hostname}/{cls.API_VERSION}/public/api-document"
9795

9896
@classmethod
9997
def get_auth_class(cls):

staxapp/contract.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def default_swagger_template() -> dict:
6464
"termsOfService": "/there_is_no_tos",
6565
"contact": {"url": "https://stax.io"},
6666
},
67-
servers=[{"url": f"https://{Config._hostname}"}],
67+
servers=[{"url": f"https://{Config.hostname}"}],
6868
paths=dict(),
6969
components={
7070
"securitySchemes": {

0 commit comments

Comments
 (0)