Skip to content

Commit

Permalink
replace all references to project_name parameter with container_path (#…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
jryurkanin authored May 15, 2024
1 parent f08d77e commit 66817fd
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 25 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion docs/api_wrapper.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
6 changes: 3 additions & 3 deletions docs/storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)


###############
Expand Down Expand Up @@ -130,4 +130,4 @@ if result is not None:
else:
print("Delete freezer: no results returned")
exit()
```
```
4 changes: 2 additions & 2 deletions samples/domain_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions samples/experiment_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions samples/experiment_platemetadata_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

###################
Expand Down
14 changes: 5 additions & 9 deletions samples/query_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -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"
Expand Down Expand Up @@ -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)
Expand All @@ -89,15 +85,15 @@


# 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)
except ServerNotFoundError:
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)
Expand Down
4 changes: 2 additions & 2 deletions samples/sampleset_domain_example.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions samples/security_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


###############
Expand Down

0 comments on commit 66817fd

Please sign in to comment.