finish v1 py sdk mvp

This commit is contained in:
Kenneth Bingham 2025-02-27 15:46:47 -05:00
parent 7545eeadb3
commit 0074ad8ff5
No known key found for this signature in database
GPG Key ID: 31709281860130B6
6 changed files with 10 additions and 11 deletions

View File

@ -1,4 +1,4 @@
{ {
"packageName":"zrok_api", "packageName":"zrok_api",
"projectName":"zrok_sdk" "projectName":"zrok_sdk"
} }

View File

@ -1,3 +1,2 @@
openziti==0.8.1 zrok
requests==2.31.0 requests
zrok

View File

@ -1,3 +1,4 @@
zrok
flask flask
requests requests
waitress waitress

View File

@ -37,9 +37,9 @@ def CreateAccess(root: Root, request: model.AccessRequest) -> model.Access:
res = ShareApi(zrok).access(body=out) res = ShareApi(zrok).access(body=out)
except Exception as e: except Exception as e:
raise Exception("unable to create access", e) raise Exception("unable to create access", e)
return model.Access(Token=res.frontend_token, return model.Access(Token=res['frontendToken'],
ShareToken=request.ShareToken, ShareToken=request.ShareToken,
BackendMode=res.backend_mode) BackendMode=res['backendMode'])
def DeleteAccess(root: Root, acc: model.Access): def DeleteAccess(root: Root, acc: model.Access):

View File

@ -89,16 +89,15 @@ class Root:
"""Check if the client version is compatible with the API.""" """Check if the client version is compatible with the API."""
metadata_api = zrok.MetadataApi(zrock_client) metadata_api = zrok.MetadataApi(zrock_client)
try: try:
print(f"Sending client version: {V}") # Log the version being sent
data, status_code, headers = metadata_api.client_version_check_with_http_info(body={"clientVersion": V}) data, status_code, headers = metadata_api.client_version_check_with_http_info(body={"clientVersion": V})
# Check if the response status code is 200 OK # Check if the response status code is 200 OK
if status_code != 200: if status_code != 200:
raise Exception(f"Client version check failed: Unexpected status code {status_code}") raise Exception(f"Client version check failed: Unexpected status code {status_code}")
# Success case - status code is 200 and empty response body is expected # Success case - status code is 200 and empty response body is expected
return return
except Exception as e: except Exception as e:
raise Exception(f"Client version check failed: {str(e)}") raise Exception(f"Client version check failed: {str(e)}")

View File

@ -34,7 +34,7 @@ class AccessRequest(object):
attribute_map = { attribute_map = {
'env_zid': 'envZId', 'env_zid': 'envZId',
'shr_token': 'shrToken' 'shr_token': 'shareToken'
} }
def __init__(self, env_zid=None, shr_token=None): # noqa: E501 def __init__(self, env_zid=None, shr_token=None): # noqa: E501