Skip to content

Commit

Permalink
Register app directly using execute
Browse files Browse the repository at this point in the history
  • Loading branch information
ruscoder committed Aug 11, 2023
1 parent 78d85e9 commit aa22a9c
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions aidbox_python_sdk/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,20 @@ def setup_routes(app):


async def register_app(sdk: SDK, client: AsyncAidboxClient):
app_resource = client.resource(
"App",
**sdk.build_manifest() ,
)
app_manifest = sdk.build_manifest()

try:
await app_resource.save()
# We create app directly using execute to avoid conversion
await client.execute(
f"/App/{app_manifest.id}", method="put", data=app_manifest)

logger.info("Creating seeds and applying migrations")
await sdk.create_seed_resources(client)
await sdk.apply_migrations(client)
logger.info("Aidbox app successfully registered")
except OperationOutcome as error:
logger.error(
"Error during the App registration: {}".format(json.dumps(error, indent=2))
"Error during the App registration: %s", json.dumps(error, indent=2)
)
sys.exit(errno.EINTR)
except (
Expand Down

0 comments on commit aa22a9c

Please sign in to comment.