From 66817fd4789a205580f1ce87f494c750eedede39 Mon Sep 17 00:00:00 2001 From: jryurkanin <104916543+jryurkanin@users.noreply.github.com> Date: Wed, 15 May 2024 13:57:26 -0500 Subject: [PATCH] replace all references to project_name parameter with container_path (#75) * Update README.md * Update README.md * Update query_examples.py example data referenced in comment does not exist * Update query_examples.py replace project_name references with container_path * Update sampleset_domain_example.py replace project_name references with container_path * Update security_example.py replace project_name reference with container_path * Update storage.md replace project_name reference with container_path * Update experiment_example.py replace project_name with container_path * Update experiment_platemetadata_example.py replace project_name with container_path * Update domain_example.py replace project_name with container_path * Update api_wrapper.md replace references to projects with container path * Update README.md --- README.md | 7 +++++-- docs/api_wrapper.md | 2 +- docs/storage.md | 6 +++--- samples/domain_example.py | 4 ++-- samples/experiment_example.py | 4 ++-- samples/experiment_platemetadata_example.py | 4 ++-- samples/query_examples.py | 14 +++++--------- samples/sampleset_domain_example.py | 4 ++-- samples/security_example.py | 4 ++-- 9 files changed, 24 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 82156d5..c70c1f9 100644 --- a/README.md +++ b/README.md @@ -93,12 +93,15 @@ from labkey.api_wrapper import APIWrapper print("Create an APIWrapper") labkey_server = 'localhost:8080' -project_name = 'ModuleAssayTest' # Project folder name +container_path = 'Tutorials/HIV Study' # in this example, Tutorials is a project name and HIV study is a subfolder under it. contextPath = 'labkey' schema = 'core' table = 'Users' -api = APIWrapper(labkey_server, project_name, contextPath, use_ssl=False) +# Note: If developing against localhost with https disabled, set use_ssl=False below +api = APIWrapper(labkey_server, container_path, contextPath) + +# Makes an API request to https://www.example.com/labkey/tutorials/hiv%20study/query-getQuery.api result = api.query.select_rows(schema, table) if result is not None: diff --git a/docs/api_wrapper.md b/docs/api_wrapper.md index 63ae3e7..b1cf2bf 100644 --- a/docs/api_wrapper.md +++ b/docs/api_wrapper.md @@ -52,7 +52,7 @@ from labkey.api_wrapper import APIWrapper print("Create an APIWrapper") labkey_server = 'www.example.com' -container_path = 'ModuleAssayTest' # Project folder name +container_path = 'Tutorials/HIV Study' # Full project/folder container path contextPath = 'labkey' schema = 'core' table = 'Users' diff --git a/docs/storage.md b/docs/storage.md index 9061b6a..8fe6d0b 100644 --- a/docs/storage.md +++ b/docs/storage.md @@ -31,9 +31,9 @@ The specific set of props will differ for each storage item type: from labkey.api_wrapper import APIWrapper labkey_server = "localhost:8080" -project_name = "FM API Test" # Project folder name +container_path = 'Tutorials/HIV Study' # Full project/folder container path contextPath = "labkey" -api = APIWrapper(labkey_server, project_name, contextPath, use_ssl=False) +api = APIWrapper(labkey_server, container_path, contextPath, use_ssl=False) ############### @@ -130,4 +130,4 @@ if result is not None: else: print("Delete freezer: no results returned") exit() -``` \ No newline at end of file +``` diff --git a/samples/domain_example.py b/samples/domain_example.py index 48a9c90..6f39a1f 100644 --- a/samples/domain_example.py +++ b/samples/domain_example.py @@ -18,9 +18,9 @@ from labkey.query import QueryFilter labkey_server = "localhost:8080" -project_name = "Study" # Project folder name +container_path = 'Tutorials/HIV Study' # Full project/folder container path context_path = "labkey" -api = APIWrapper(labkey_server, project_name, context_path, use_ssl=False) +api = APIWrapper(labkey_server, container_path, context_path, use_ssl=False) ################### # Create a list domain diff --git a/samples/experiment_example.py b/samples/experiment_example.py index defba78..fa00b07 100644 --- a/samples/experiment_example.py +++ b/samples/experiment_example.py @@ -17,9 +17,9 @@ from labkey.experiment import Batch, Run labkey_server = "localhost:8080" -project_name = "ModulesAssayTest" # Project folder name +container_path = 'Tutorials/HIV Study' # Full project/folder container path context_path = "labkey" -api = APIWrapper(labkey_server, project_name, context_path, use_ssl=False) +api = APIWrapper(labkey_server, container_path, context_path, use_ssl=False) assay_id = 3315 # provide one from your server diff --git a/samples/experiment_platemetadata_example.py b/samples/experiment_platemetadata_example.py index 7b5eec5..95c944c 100644 --- a/samples/experiment_platemetadata_example.py +++ b/samples/experiment_platemetadata_example.py @@ -17,9 +17,9 @@ from labkey.experiment import Batch, Run labkey_server = "localhost:8080" -project_name = "assays" # Project folder name +container_path = 'Tutorials/assay' # Full project/folder container path context_path = "labkey" -api = APIWrapper(labkey_server, project_name, context_path, use_ssl=False) +api = APIWrapper(labkey_server, container_path, context_path, use_ssl=False) assay_id = 310 # provide one from your server ################### diff --git a/samples/query_examples.py b/samples/query_examples.py index 1007ff3..6261eec 100644 --- a/samples/query_examples.py +++ b/samples/query_examples.py @@ -15,10 +15,6 @@ # """ Examples using the Query.py API - -Sample data from the New Study tutorial on labkey.org: - https://www.labkey.org/Documentation/wiki-page.view?name=studySetupManual - """ from labkey.api_wrapper import APIWrapper from labkey.exceptions import ( @@ -34,9 +30,9 @@ print("Create a server context") labkey_server = "localhost:8080" -project_name = "ModuleAssayTest" # Project folder name +container_path = 'Tutorials/HIV Study' # Full project/folder container path context_path = "labkey" -api = APIWrapper(labkey_server, project_name, context_path, use_ssl=False) +api = APIWrapper(labkey_server, container_path, context_path, use_ssl=False) schema = "lists" table = "Demographics" @@ -80,7 +76,7 @@ print("Caught bad schema") # catch SSL error -ssl_api = APIWrapper(labkey_server, project_name, context_path, use_ssl=True) +ssl_api = APIWrapper(labkey_server, container_path, context_path, use_ssl=True) try: result = ssl_api.query.select_rows(schema, table) print(result) @@ -89,7 +85,7 @@ # catch bad context path -bad_api = APIWrapper(labkey_server, project_name, "", use_ssl=False) +bad_api = APIWrapper(labkey_server, container_path, "", use_ssl=False) try: result = bad_api.query.select_rows(schema, table) print(result) @@ -97,7 +93,7 @@ print("Caught context path") # catch bad folder path error -bad_api = APIWrapper(labkey_server, "bad_project_name", context_path, use_ssl=False) +bad_api = APIWrapper(labkey_server, "bad_container_path", context_path, use_ssl=False) try: result = bad_api.query.select_rows(schema, table) print(result) diff --git a/samples/sampleset_domain_example.py b/samples/sampleset_domain_example.py index 6bc542d..4af9ef1 100644 --- a/samples/sampleset_domain_example.py +++ b/samples/sampleset_domain_example.py @@ -1,9 +1,9 @@ from labkey.api_wrapper import APIWrapper labkey_server = "localhost:8080" -project_name = "MySamples" # Project folder name +container_path = "Tutorials/MySamples" # Full project/folder container path context_path = "labkey" -api = APIWrapper(labkey_server, project_name, context_path, use_ssl=False) +api = APIWrapper(labkey_server, container_path, context_path, use_ssl=False) ################### # Create a SampleSet domain diff --git a/samples/security_example.py b/samples/security_example.py index 6f055b2..25a6952 100644 --- a/samples/security_example.py +++ b/samples/security_example.py @@ -17,9 +17,9 @@ from labkey.exceptions import ServerNotFoundError labkey_server = "localhost:8080" -project_name = "Home" # Project folder name +container_path = 'Tutorials/HIV Study' # Full project/folder container path contextPath = "labkey" -api = APIWrapper(labkey_server, project_name, contextPath, use_ssl=False) +api = APIWrapper(labkey_server, container_path, contextPath, use_ssl=False) ###############