From 4e6486fe920088879090a245086d6da19913a8f5 Mon Sep 17 00:00:00 2001 From: augustin_s Date: Tue, 19 Oct 2021 11:38:57 +0000 Subject: [PATCH] Update README.md --- README.md | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 45e2c32..bc22bf1 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,27 @@ # py_scilog -Python client for SciLog \ No newline at end of file +Python client for SciLog + +## Examples + +### Post to a logbook associated with a pgroup + +```python +from scilog import SciLog + +url = "https://lnode2.psi.ch/api/v1" +pgroup = "p12345" + +log = SciLog(url) +logbooks = log.get_logbooks(ownerGroup=pgroup) + +# assume that there is only one logbook per pgroup +# otherwise we would need to add more filters +assert len(logbooks) == 1 +logbook = logbooks[0] + +log.select_logbook(logbook) + +res = log.send_message("

from python

") +print(res) +```