Skip to content

Commit f944a4f

Browse files
authored
docs(directory-client): Fix example script in directory client README (#4975)
* docs(directory-client): Update README.md Fix Python imports * Update README.md Fix script
1 parent caa202c commit f944a4f

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

tools/directory/README.md

+13-8
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,13 @@ If you just want to retrieve the data of a node for another purpose, you can use
2121
and `ExternalServerSession` directly:
2222

2323
```python
24-
from molgenis-emx2.directory-client import DirectorySession, ExternalServerSession
25-
from molgenis-emx2.directory-client import NodeData
24+
import logging
25+
import asyncio
26+
import os
27+
from molgenis_emx2.directory_client.directory_client import DirectorySession
28+
from molgenis_emx2.directory_client.directory_client import NodeData
29+
30+
os.environ['NN_SCHEMA_PREFIX'] = "BBMRI"
2631

2732
# Get the staging and published data of NL from the directory
2833
async def get_data():
@@ -36,18 +41,18 @@ async def get_data():
3641
# Apply the 'signin' method with the username and password
3742
session.signin(username, password)
3843

39-
nl = session.get_external_node("NL")
44+
nl = session.get_node("NL")
4045
nl_staging_data: NodeData = session.get_staging_node_data(nl)
4146
nl_published_data: NodeData = session.get_published_node_data(nl)
4247

43-
# Get the data from the external server of NL
44-
external_session = ExternalServerSession(nl)
45-
nl_external_data: NodeData = external_session.get_node_data()
46-
4748
# Now you can use the NodeData objects as you wish
48-
for person in nl_external_data.persons.rows:
49+
for person in nl_staging_data.persons.rows:
4950
print(person)
5051

52+
# Now you can use the NodeData objects as you wish
53+
for biobank in nl_published_data.biobanks.rows:
54+
print(biobank)
55+
5156
if __name__ == "__main__":
5257
asyncio.run(get_data())
5358
```

0 commit comments

Comments
 (0)