bensteUEM / ChurchToolsAPI

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

response of request in get_ct_csrf_token can return 200 with HTML 'not found' #55

Closed bensteUEM closed 1 year ago

bensteUEM commented 1 year ago

at present only the status code is checked and json.loads can fail (e.g. if not authorized)

  if response.status_code == 200:
         csrf_token = json.loads(response.content)["data"]

The method should "try" json.loads and return the error message from the html document in case it fails. This might also apply to other requests!

Issue created when running WebService with session['ct_api'] = CTAPI(domain, ct_user=user, ct_password=password) which then calls login_ct_ajax_api

bensteUEM commented 1 year ago

not reproduceable after replacing ajax login with rest login