mirror of
https://github.com/openziti/zrok.git
synced 2025-06-19 17:27:54 +02:00
finish v1 py sdk mvp
This commit is contained in:
parent
7545eeadb3
commit
0074ad8ff5
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"packageName":"zrok_api",
|
"packageName":"zrok_api",
|
||||||
"projectName":"zrok_sdk"
|
"projectName":"zrok_sdk"
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,2 @@
|
|||||||
openziti==0.8.1
|
zrok
|
||||||
requests==2.31.0
|
requests
|
||||||
zrok
|
|
@ -1,3 +1,4 @@
|
|||||||
|
zrok
|
||||||
flask
|
flask
|
||||||
requests
|
requests
|
||||||
waitress
|
waitress
|
||||||
|
@ -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):
|
||||||
|
@ -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)}")
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user