You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* ServerContext:
* Add `allow_redirects` flag to constructor
* Add `allow_redirects` flag to `make_request`
* APIWrapper Add `allow_redirects` flag
* Add UnexpectedRedirectError
* Update APIWrapper docs to not set `use_ssl=False` in example code
Copy file name to clipboardExpand all lines: docs/api_wrapper.md
+14-8Lines changed: 14 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,20 +23,23 @@ It includes the following arguments:
23
23
- Example: 'Project/Folder/Subfolder'
24
24
25
25
**context_path**
26
-
-The default value is None. Depending on how the LabKey Server instance is implemented, it may be necessary to include a value for the context_path argument. If your LabKey Server instance has text after the base URL, that is the context path.
26
+
-Defaults to `None`. Depending on how the LabKey Server instance is implemented, it may be necessary to include a value for the context_path argument. If your LabKey Server instance has text after the base URL, that is the context path.
27
27
- Example: If your home project has a URL such as https://labkey.org/contextpath/home/project-begin.view, then the context path is 'contextpath'.
28
28
29
29
**use_ssl**
30
-
-The default value is True. This should be set to True if your server is configured to use SSL. If you are not sure if your server uses SSL, refer to any URL for accessing your server. Servers using SSL will have a URL that begins with `https://` instead of `http://`. LabKey Sample Manager-only clients must have this argument set to True.
30
+
-Defaults to `True`. This should be set to True if your server is configured to use SSL. If you are not sure if your server uses SSL, refer to any URL for accessing your server. Servers using SSL will have a URL that begins with `https://` instead of `http://`. LabKey Sample Manager-only clients must have this argument set to True.
31
31
32
32
**verify_ssl**
33
-
-The default value is True. This argument toggles whether or not the SSL certificate is validated when attempting to connect to a server. This flag is useful when you are connecting to a development server with a self-signed SSL certificate, which would otherwise cause a failure. You should never disable this flag if you are connecting to a production server with a proper SSL certificate.
33
+
-Defaults to `True`. This argument toggles whether or not the SSL certificate is validated when attempting to connect to a server. This flag is useful when you are connecting to a development server with a self-signed SSL certificate, which would otherwise cause a failure. You should never disable this flag if you are connecting to a production server with a proper SSL certificate.
34
34
35
35
**api_key**
36
-
-The default value is None. Scripts can authenticate their LabKey API calls by using either a netrc file (details on that here, https://www.labkey.org/Documentation/wiki-page.view?name=netrc) or an API key (details about API keys and how to generate and manage them are here, https://www.labkey.org/Documentation/wiki-page.view?name=apikey).
36
+
-Defaults to `None`. Scripts can authenticate their LabKey API calls by using either a netrc file (details on that here, https://www.labkey.org/Documentation/wiki-page.view?name=netrc) or an API key (details about API keys and how to generate and manage them are here, https://www.labkey.org/Documentation/wiki-page.view?name=apikey).
37
37
38
38
**disable_csrf**
39
-
- The default value is False. In most cases, this argument must be set to False for API calls to work successfully as CSRF tokens are a fundamental security mechanism. For more info about using CSRF with your LabKey Server instance, see here, https://www.labkey.org/Documentation/wiki-page.view?name=csrfProtection.
39
+
- Defaults to `False`. In most cases, this argument must be set to False for API calls to work successfully as CSRF tokens are a fundamental security mechanism. For more info about using CSRF with your LabKey Server instance, see here, https://www.labkey.org/Documentation/wiki-page.view?name=csrfProtection.
40
+
41
+
**allow_redirects**
42
+
- Defaults to `False`. When the server issues a redirect during an API call the ServerContext will throw an error.
40
43
41
44
### Using LabKey Python APIs
42
45
@@ -48,13 +51,16 @@ See below for an example of how to properly use the APIWrapper class to create a
48
51
from labkey.api_wrapper import APIWrapper
49
52
50
53
print("Create an APIWrapper")
51
-
labkey_server ='localhost:8080'
52
-
project_name='ModuleAssayTest'# Project folder name
54
+
labkey_server ='www.example.com'
55
+
container_path='ModuleAssayTest'# Project folder name
53
56
contextPath ='labkey'
54
57
schema ='core'
55
58
table ='Users'
56
-
api = APIWrapper(labkey_server, project_name, contextPath, use_ssl=False)
57
59
60
+
# Note: If developing against localhost with https disabled, set use_ssl=False below
61
+
api = APIWrapper(labkey_server, container_path, contextPath)
62
+
63
+
# Makes an API request to https://www.example.com/labkey/ModuleAssayTest/query-getQuery.api
0 commit comments