bensteUEM / ChurchToolsAPI

Collection of Python files to use the API for ChurchTools
6 stars 4 forks source link

Fetching song_id on newly updated song fails script #26

Closed bensteUEM closed 1 year ago

bensteUEM commented 1 year ago
/home/benste/PycharmProjects/SongBeamerQS/venv/bin/python /home/benste/PycharmProjects/SongBeamerQS/main.py 
Traceback (most recent call last):
  File "/home/benste/PycharmProjects/SongBeamerQS/main.py", line 421, in <module>
    upload_new_local_songs_and_generate_ct_id(df_sng, df_ct)
  File "/home/benste/PycharmProjects/SongBeamerQS/main.py", line 353, in upload_new_local_songs_and_generate_ct_id
    song_id = api.create_song(title=title, songcategory_id=category_id, author=authors,
  File "/home/benste/PycharmProjects/ChurchToolsAPI/ChurchToolsApi.py", line 395, in create_song
    new_id = int(json.loads(response.content)['data'])
KeyError: 'data'

Process finished with exit code 1

Creating a new song without ID and running the SongBeamerQS script results in an error which is likely caused by the return value of create_song() in CT API

Module logging does shows 403 ... maybe auth related?

2023-01-19 16:52:05,761 root       INFO     Uploading Song '910 Psalm 86' with Category ID '9' from '' with (C) from '' and ccli ''
2023-01-19 16:52:05,834 urllib3.connectionpool DEBUG    https://elkw1610.krz.tools:443 "POST /?q=churchservice/ajax&func=addNewSong HTTP/1.1" 403 None
bensteUEM commented 1 year ago

Issue was missing "Veranstaltungen" permission and return of NONE ID on song creation.