[![conda_publish](https://github.com/paulscherrerinstitute/py_elog/actions/workflows/conda_publish.yaml/badge.svg)](https://github.com/paulscherrerinstitute/py_elog/actions/workflows/conda_publish.yaml)
[![pypi_publish](https://github.com/paulscherrerinstitute/py_elog/actions/workflows/pypi_publish.yaml/badge.svg)](https://github.com/paulscherrerinstitute/py_elog/actions/workflows/pypi_publish.yaml)
[![python_test](https://github.com/paulscherrerinstitute/py_elog/actions/workflows/python_test.yaml/badge.svg)](https://github.com/paulscherrerinstitute/py_elog/actions/workflows/python_test.yaml)
# Overview
This Python module provides a native interface [electronic logbooks](https://midas.psi.ch/elog/). It is compatible with Python versions 3.5 and higher.
# Usage
For accessing a logbook at ```http[s]://<hostename>:<port>/[<subdir>/]<logbook>/[<msg_id>]``` a logbook handle must be retrieved.
```python
import elog
# Open GFA SwissFEL test logbook
logbook = elog.open('https://elog-gfa.psi.ch/SwissFEL+test/')
# Contstructor using detailed arguments
# Open demo logbook on local host: http://localhost:8080/demo/
logbook = elog.open('localhost', 'demo', port=8080, use_ssl=False)
```
Once you have hold of the logbook handle one of its public methods can be used to read, create, reply to, edit or delete the message.
## Get Existing Message Ids
Get all the existing message ids of a logbook
```python
message_ids = logbook.get_message_ids()
```
To get if of the last inserted message
```python
last_message_id = logbook.get_last_message_id()
```
## Read Message
```python
# Read message with with message ID = 23
message, attributes, attachments = logbook.read(23)
```
## Create Message
```python
# Create new message with some text, attributes (dict of attributes + kwargs) and attachments
new_msg_id = logbook.post('This is message text', attributes=dict_of_attributes, attachments=list_of_attachments,
attribute_as_param='value')
```
What attributes are required is determined by the configuration of the elog server (keywork `Required Attributes`).
If the configuration looks like this:
```
Required Attributes = Author, Type
```
You have to provide author and type when posting a message.
In case type need to be specified, the supported keywords can as well be found in the elog configuration with the key `Options Type`.
If the config looks like this:
```
Options Type = Routine, Software Installation, Problem Fixed, Configuration, Other
```
A working create call would look like this:
```python
new_msg_id = logbook.post('This is message text', author='me', type='Routine')
```
## Reply to Message
```python
# Reply to message with ID=23
new_msg_id = logbook.post('This is a reply', msg_id=23, reply=True, attributes=dict_of_attributes,
attachments=list_of_attachments, attribute_as_param='value')
```
## Edit Message
```python
# Edit message with ID=23. Changed message text, some attributes (dict of edited attributes + kwargs) and new attachments
edited_msg_id = logbook.post('This is new message text', msg_id=23, attributes=dict_of_changed_attributes,
attachments=list_of_new_attachments, attribute_as_param='new value')
```
## Search Messages
```python
# Search for text in messages or specify attributes for search, returns list of message ids
logbook.search('Hello World')
logbook.search('Hello World', n_results=20, scope='attribname')
logbook.search({'attribname': 'Hello World', ...})
```
## Delete Message (and all its replies)
```python
# Delete message with ID=23. All its replies will also be deleted.
logbook.delete(23)
```
__Note:__ Due to the way elog implements delete this function is only supported on english logbooks.
# Installation
The Elog module and only depends on the `passlib` and `requests` library used for password encryption and http(s) communication. It is packed as [anaconda package](https://anaconda.org/paulscherrerinstitute/elog) and can be installed as follows:
```bash
conda install -c paulscherrerinstitute elog
```
Raw data
{
"_id": null,
"home_page": "https://github.com/paulscherrerinstitute/py_elog",
"name": "py-elog",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "elog,electronic,logbook",
"author": "Paul Scherrer Institute (PSI)",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/67/f7/ef64c64cac6369e377f18c030fa874148061932d2e19c2e48a59f7b1de5b/py_elog-1.3.16.tar.gz",
"platform": null,
"description": "[![conda_publish](https://github.com/paulscherrerinstitute/py_elog/actions/workflows/conda_publish.yaml/badge.svg)](https://github.com/paulscherrerinstitute/py_elog/actions/workflows/conda_publish.yaml)\n[![pypi_publish](https://github.com/paulscherrerinstitute/py_elog/actions/workflows/pypi_publish.yaml/badge.svg)](https://github.com/paulscherrerinstitute/py_elog/actions/workflows/pypi_publish.yaml)\n[![python_test](https://github.com/paulscherrerinstitute/py_elog/actions/workflows/python_test.yaml/badge.svg)](https://github.com/paulscherrerinstitute/py_elog/actions/workflows/python_test.yaml)\n\n# Overview\nThis Python module provides a native interface [electronic logbooks](https://midas.psi.ch/elog/). It is compatible with Python versions 3.5 and higher.\n\n# Usage\n\nFor accessing a logbook at ```http[s]://<hostename>:<port>/[<subdir>/]<logbook>/[<msg_id>]``` a logbook handle must be retrieved.\n\n```python\nimport elog\n\n# Open GFA SwissFEL test logbook\nlogbook = elog.open('https://elog-gfa.psi.ch/SwissFEL+test/')\n\n# Contstructor using detailed arguments\n# Open demo logbook on local host: http://localhost:8080/demo/\nlogbook = elog.open('localhost', 'demo', port=8080, use_ssl=False)\n```\n\nOnce you have hold of the logbook handle one of its public methods can be used to read, create, reply to, edit or delete the message.\n\n## Get Existing Message Ids\nGet all the existing message ids of a logbook\n\n```python\nmessage_ids = logbook.get_message_ids()\n```\n\nTo get if of the last inserted message\n```python\nlast_message_id = logbook.get_last_message_id()\n```\n\n## Read Message\n\n```python\n# Read message with with message ID = 23\nmessage, attributes, attachments = logbook.read(23)\n```\n\n## Create Message\n\n```python\n# Create new message with some text, attributes (dict of attributes + kwargs) and attachments\nnew_msg_id = logbook.post('This is message text', attributes=dict_of_attributes, attachments=list_of_attachments,\n attribute_as_param='value')\n```\n \nWhat attributes are required is determined by the configuration of the elog server (keywork `Required Attributes`).\nIf the configuration looks like this:\n \n```\nRequired Attributes = Author, Type\n```\n \nYou have to provide author and type when posting a message.\n \nIn case type need to be specified, the supported keywords can as well be found in the elog configuration with the key `Options Type`.\n \nIf the config looks like this:\n```\nOptions Type = Routine, Software Installation, Problem Fixed, Configuration, Other\n```\n\nA working create call would look like this:\n\n```python\nnew_msg_id = logbook.post('This is message text', author='me', type='Routine')\n```\n\n \n\n## Reply to Message\n\n```python\n# Reply to message with ID=23\nnew_msg_id = logbook.post('This is a reply', msg_id=23, reply=True, attributes=dict_of_attributes,\n attachments=list_of_attachments, attribute_as_param='value')\n```\n\n## Edit Message\n\n```python\n# Edit message with ID=23. Changed message text, some attributes (dict of edited attributes + kwargs) and new attachments\nedited_msg_id = logbook.post('This is new message text', msg_id=23, attributes=dict_of_changed_attributes,\n attachments=list_of_new_attachments, attribute_as_param='new value')\n```\n\n## Search Messages\n\n```python\n# Search for text in messages or specify attributes for search, returns list of message ids\nlogbook.search('Hello World')\nlogbook.search('Hello World', n_results=20, scope='attribname')\nlogbook.search({'attribname': 'Hello World', ...})\n```\n\n## Delete Message (and all its replies)\n\n```python\n# Delete message with ID=23. All its replies will also be deleted.\nlogbook.delete(23)\n```\n\n__Note:__ Due to the way elog implements delete this function is only supported on english logbooks.\n\n# Installation\nThe Elog module and only depends on the `passlib` and `requests` library used for password encryption and http(s) communication. It is packed as [anaconda package](https://anaconda.org/paulscherrerinstitute/elog) and can be installed as follows:\n\n```bash\nconda install -c paulscherrerinstitute elog\n```\n",
"bugtrack_url": null,
"license": "",
"summary": "Python library to access Elog.",
"version": "1.3.16",
"split_keywords": [
"elog",
"electronic",
"logbook"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "e0aa86fe2c7f1d8dd144358559b443dc",
"sha256": "93b28b85ee9306c2d3b2366abd43994d5b88c56bf3abb8b624d37b1040c30ea7"
},
"downloads": -1,
"filename": "py_elog-1.3.16-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e0aa86fe2c7f1d8dd144358559b443dc",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 24851,
"upload_time": "2022-12-12T14:20:22",
"upload_time_iso_8601": "2022-12-12T14:20:22.656802Z",
"url": "https://files.pythonhosted.org/packages/e8/ac/5ee9cbaf104c4a9f749f7315ef3eabeea97b272b668f358f7a1d724129c1/py_elog-1.3.16-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "e40f9e303e83b3868edd0a8d0944b8bf",
"sha256": "b95f6ef920f947636f8eea53aa88efbd803c1e7e5bc01df20402ee9b38364122"
},
"downloads": -1,
"filename": "py_elog-1.3.16.tar.gz",
"has_sig": false,
"md5_digest": "e40f9e303e83b3868edd0a8d0944b8bf",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 25509,
"upload_time": "2022-12-12T14:20:23",
"upload_time_iso_8601": "2022-12-12T14:20:23.739155Z",
"url": "https://files.pythonhosted.org/packages/67/f7/ef64c64cac6369e377f18c030fa874148061932d2e19c2e48a59f7b1de5b/py_elog-1.3.16.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-12 14:20:23",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "paulscherrerinstitute",
"github_project": "py_elog",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "requests",
"specs": []
},
{
"name": "passlib",
"specs": []
},
{
"name": "lxml",
"specs": []
}
],
"lcname": "py-elog"
}