X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/c10e9e5f3398d40a3346c7d7c1f84bf50262b8ec..415910149bed2eef6ae818b7c059d413934df06e:/doc/sdk/python/example.html.textile.liquid diff --git a/doc/sdk/python/example.html.textile.liquid b/doc/sdk/python/example.html.textile.liquid index 7ae5e58f8a..504d0784f0 100644 --- a/doc/sdk/python/example.html.textile.liquid +++ b/doc/sdk/python/example.html.textile.liquid @@ -2,35 +2,55 @@ layout: default navsection: sdk navmenu: Python -title: Python SDK examples +title: Examples ... +{% comment %} +Copyright (C) The Arvados Authors. All rights reserved. + +SPDX-License-Identifier: CC-BY-SA-3.0 +{% endcomment %} + +In these examples, the site prefix is @aaaaa@. + +h2. Initialize SDK + +{% codeblock as python %} +import arvados +api = arvados.api("v1") +{% endcodeblock %} h2. create -
-result = api.collection().create(body={"collection": {"name": "create example"}}).execute()
-
+{% codeblock as python %} +result = api.collections().create(body={"collection": {"name": "create example"}}).execute() +{% endcodeblock %} h2. delete -
-result = api.collection().delete(uuid="aaaaa-bbbbb-ccccccccccccccc").execute()
-
+{% codeblock as python %} +result = api.collections().delete(uuid="aaaaa-4zz18-ccccccccccccccc").execute() +{% endcodeblock %} h2. get -
-result = api.collection().get(uuid="aaaaa-bbbbb-ccccccccccccccc").execute()
-
+{% codeblock as python %} +result = api.collections().get(uuid="aaaaa-4zz18-ccccccccccccccc").execute() +{% endcodeblock %} h2. list -
-result = api.collection().list(filters=[["uuid", "=", "aaaaa-bbbbb-ccccccccccccccc"]]).execute()
-
+{% codeblock as python %} +result = api.collections().list(filters=[["uuid", "=", "aaaaa-bbbbb-ccccccccccccccc"]]).execute() +{% endcodeblock %} h2. update -
-result = api.collection().update(uuid="aaaaa-bbbbb-ccccccccccccccc", body={"collection": {"name": "update example"}}).execute()
-
+{% codeblock as python %} +result = api.collections().update(uuid="aaaaa-4zz18-ccccccccccccccc", body={"collection": {"name": "update example"}}).execute() +{% endcodeblock %} + +h2. Get current user + +{% codeblock as python %} +result = api.users().current().execute() +{% endcodeblock %}