Skip to content

Commit b9d8565

Browse files
committed
simplified local execution by adding Jupyter Notebook
1 parent 5638b54 commit b9d8565

2 files changed

Lines changed: 64 additions & 1 deletion

File tree

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ The respective function do have a hint like the one below in the docstring of th
4848
IMPORTANT - This test method and the parameters used depend on the target system!
4949
```
5050

51-
You are more than welcome to contribute additional code using respective feature branches and pull requests. New functions should always include respective test cases (that can be adjusted to the automated test system upon merge request)
51+
You are more than welcome to contribute additional code using respective feature branches and pull requests. New functions should always include respective test cases (that can be adjusted to the automated test system upon merge request)+
52+
53+
There is also a main.ipynb which can be used to quickly execute single actions without writing a seperate python project
5254

5355
## Compatibility
5456

main.ipynb

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# How to Use:\n",
8+
"This Notebook should ease the use of the API for \"cleanup\" tasks. It includes some sample for specific use cases that can be adjusted.\n",
9+
"1. run first block to prepare excecutions by creating api connection\n",
10+
"2. run any following block to execute a specific function"
11+
]
12+
},
13+
{
14+
"cell_type": "code",
15+
"execution_count": null,
16+
"metadata": {},
17+
"outputs": [],
18+
"source": [
19+
"import logging\n",
20+
"from ChurchToolsApi import ChurchToolsApi\n",
21+
"\n",
22+
"logging.getLogger().setLevel(logging.INFO)\n",
23+
"logging.info(\"Started main\")\n",
24+
"\n",
25+
"# Create Session\n",
26+
"from secure.config import ct_domain\n",
27+
"from secure.config import ct_token\n",
28+
"api = ChurchToolsApi(ct_domain)\n",
29+
"api.login_ct_rest_api(ct_token=ct_token)"
30+
]
31+
},
32+
{
33+
"cell_type": "markdown",
34+
"metadata": {},
35+
"source": [
36+
"## Song Tag - mass change\n",
37+
"Helper to append a tag to all songs - e.g. 51 is tag:\"in ChurchTools vor Skript Import\""
38+
]
39+
},
40+
{
41+
"cell_type": "code",
42+
"execution_count": null,
43+
"metadata": {},
44+
"outputs": [],
45+
"source": [
46+
"songs = api.get_songs()\n",
47+
"all_song_ids = [value['id'] for value in songs]\n",
48+
"for id in all_song_ids:\n",
49+
" api.add_song_tag(id, 51)"
50+
]
51+
}
52+
],
53+
"metadata": {
54+
"language_info": {
55+
"name": "python"
56+
},
57+
"orig_nbformat": 4
58+
},
59+
"nbformat": 4,
60+
"nbformat_minor": 2
61+
}

0 commit comments

Comments
 (0)