# OMERO user token
Python package that creates long running user tokens for use with the OMERO
API under non-interactive, headless conditions.
## Requirements
* Python 3.6+
* OMERO.server 5.6
## Usage
Creating a user token and making it active:
omero_user_token set
Please see `omero_user_token set --help` for detailed information. The
default server hostname and port can be set in
`${HOME}/.omero_user_token/config` using an INI file compatible style:
[server]
host = omero.example.com
port = 4064
Retrieving the current active token (validation will be performed):
omero_user_token get
## Token format
The token format is as follows:
<omero_session_key>@<host>:<port>
## Example usage
### Bash:
```bash
token=$(omero_user_token get)
if [ $? -ne 0]; then
echo "No valid token found"
exit 1
fi
key=$(echo "${token}" | sed -e 's/^\(.*\)@.*:.*$/\1/')
host=$(echo "${token}" | sed -e 's/^.*@\(.*\):.*$/\1/')
port=$(echo "${token}" | sed -e 's/^.*@.*:\(.*\)$/\1/')
echo "Connecting to ${host}:${port} with key ${key}"
```
### Python:
```python
from omero_user_token import getter
token = getter()
if token is not None:
omero_session_key = token[:token.find('@')]
host, port = token[token.find('@') + 1:].split(':')
port = int(port)
key = token[:token.find('@')]
print(f"Connecting to {host}:{port} with key {key}")
```
## License
OMERO user token is distributed under the terms of the GPL v2 license.
Please see `LICENSE.txt` for further details.
Raw data
{
"_id": null,
"home_page": "https://github.com/glencoesoftware/omero-user-token",
"name": "omero-user-token",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "",
"author": "Glencoe Software, Inc.",
"author_email": "info@glencoesoftware.com",
"download_url": "https://files.pythonhosted.org/packages/bf/59/fbfba04b68d0a9d13d5a7d24e9831d027c68deb99f0738f5dd52082a8436/omero-user-token-0.3.0.tar.gz",
"platform": "any",
"description": "# OMERO user token\n\nPython package that creates long running user tokens for use with the OMERO\nAPI under non-interactive, headless conditions.\n\n## Requirements\n\n* Python 3.6+\n* OMERO.server 5.6\n\n## Usage\n\nCreating a user token and making it active:\n\n omero_user_token set\n\nPlease see `omero_user_token set --help` for detailed information. The\ndefault server hostname and port can be set in\n`${HOME}/.omero_user_token/config` using an INI file compatible style:\n\n [server]\n host = omero.example.com\n port = 4064\n\nRetrieving the current active token (validation will be performed):\n\n omero_user_token get\n\n## Token format\n\nThe token format is as follows:\n\n <omero_session_key>@<host>:<port>\n\n## Example usage\n\n### Bash:\n```bash\ntoken=$(omero_user_token get)\nif [ $? -ne 0]; then\n echo \"No valid token found\"\n exit 1\nfi\nkey=$(echo \"${token}\" | sed -e 's/^\\(.*\\)@.*:.*$/\\1/')\nhost=$(echo \"${token}\" | sed -e 's/^.*@\\(.*\\):.*$/\\1/')\nport=$(echo \"${token}\" | sed -e 's/^.*@.*:\\(.*\\)$/\\1/')\necho \"Connecting to ${host}:${port} with key ${key}\"\n```\n\n### Python:\n```python\nfrom omero_user_token import getter\ntoken = getter()\nif token is not None:\n omero_session_key = token[:token.find('@')]\n host, port = token[token.find('@') + 1:].split(':')\n port = int(port)\n key = token[:token.find('@')]\n print(f\"Connecting to {host}:{port} with key {key}\")\n```\n\n## License\n\nOMERO user token is distributed under the terms of the GPL v2 license.\nPlease see `LICENSE.txt` for further details.\n\n\n",
"bugtrack_url": null,
"license": "",
"summary": "OMERO user token management system",
"version": "0.3.0",
"project_urls": {
"Homepage": "https://github.com/glencoesoftware/omero-user-token"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e40be5eccc0d83993ac64e4b5a0284a8c113fe0ab464557d263e4ca7e1b98696",
"md5": "00cb0c1a92b797ecb8239f07eb7e3530",
"sha256": "4cd36d138063e077810573f97496eb62d03a2f6cfb92c86ac3ee48c4f2e7a3f7"
},
"downloads": -1,
"filename": "omero_user_token-0.3.0-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "00cb0c1a92b797ecb8239f07eb7e3530",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.6",
"size": 11403,
"upload_time": "2023-05-10T07:26:21",
"upload_time_iso_8601": "2023-05-10T07:26:21.376481Z",
"url": "https://files.pythonhosted.org/packages/e4/0b/e5eccc0d83993ac64e4b5a0284a8c113fe0ab464557d263e4ca7e1b98696/omero_user_token-0.3.0-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "bf59fbfba04b68d0a9d13d5a7d24e9831d027c68deb99f0738f5dd52082a8436",
"md5": "374818258694487062b9aba8f1079c6c",
"sha256": "22842c7dd00e264f340605d0c595c8ca0d83742728ac231b3ca53153a18505b0"
},
"downloads": -1,
"filename": "omero-user-token-0.3.0.tar.gz",
"has_sig": false,
"md5_digest": "374818258694487062b9aba8f1079c6c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 11886,
"upload_time": "2023-05-10T07:26:23",
"upload_time_iso_8601": "2023-05-10T07:26:23.469249Z",
"url": "https://files.pythonhosted.org/packages/bf/59/fbfba04b68d0a9d13d5a7d24e9831d027c68deb99f0738f5dd52082a8436/omero-user-token-0.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-10 07:26:23",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "glencoesoftware",
"github_project": "omero-user-token",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "omero-user-token"
}