Dear LabKey support team,
We have a labkey instance where we use a first layer of authentication using a federated identity provider and we don't use the session token to authorise the user to LabKey instead we use the labkey default authentication as a second layer.
Now we would like to use the python api to such an instance and the url of the instance will redirect you to the identity provider to authenticate, how can we use the labkey specific authentication to access the api in such scenarios?
When I try to do the example python api access from the instance using a netrc file, I get the following error message:
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/Users/scripts/data-management/labkey_data_parsers/clinical_data_parser/parse_redcap_csv.py", line 59, in <module>
main()
File "/Users/scripts/data-management/labkey_data_parsers/clinical_data_parser/parse_redcap_csv.py", line 50, in main
result = api.query.select_rows(schema, table)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/scripts/data-management/labkey-data-management-env/lib/python3.12/site-packages/labkey/query.py", line 680, in select_rows
return select_rows(
^^^^^^^^^^^^
File "/Users/scripts/data-management/labkey-data-management-env/lib/python3.12/site-packages/labkey/query.py", line 462, in select_rows
return server_context.make_request(url, payload, timeout=timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/scripts/data-management/labkey-data-management-env/lib/python3.12/site-packages/labkey/server_context.py", line 192, in make_request
self._session.headers.update({CSRF_TOKEN: response["CSRF"]})
~~~~~~~~^^^^^^^^
KeyError: 'CSRF'
regards,
Vipin