Update README.md
This commit is contained in:
24
README.md
24
README.md
@ -1,3 +1,27 @@
|
|||||||
# py_scilog
|
# py_scilog
|
||||||
|
|
||||||
Python client for SciLog
|
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("<p>from python</p>")
|
||||||
|
print(res)
|
||||||
|
```
|
||||||
|
Reference in New Issue
Block a user