Python notify

Hi I’ve wrote a script to use notify from an external source. I’m making some backup software and need to notify the user of finished updates. I find that it’s incredibly difficult to find the right parameters for the api.

My most specific problem is that I can’t seem to acces presistant_notification.create or dismiss. I have no idea does anyone know what the problem is? The first 2 functions do their work perfectly but the second 2 give request errors and missing schema errors.

I’d also like to know if there’s good documentation besides what’s already on first hand when first page searching google.

from requests import post
import json

tokenKey = open("token.key", "r")
homeURL = open("ha.url", "r")


def send_notification(title, message):
    url = homeURL.read() + "/api/services/notify/notify"
    headers = {
        "Authorization": "Bearer " + tokenKey.read(),
        "content-type": "application/json",
    }
    data = {
        "title": title,
        "message": message,
    }
    post(url, headers=headers, json=data)


def send_persistent(title, message):
    url = homeURL.read() + "/api/services/notify/persistent_notification"
    headers = {
        "Authorization": "Bearer " + tokenKey.read(),
        "content-type": "application/json",
    }
    data = {
        "title": title,
        "message": message,
    }
    post(url, headers=headers, json=data)


def create_persistent(id2, title, message):
    url = homeURL.read() + "/api/services/persistent_notification/create"
    headers = {
        "Authorization": "Bearer " + tokenKey.read(),
        "content-type": "application/json",
    }
    data = {
        "notification_id": id2,
        "title": title,
        "message": message,
    }
    post(url, headers=headers, json=data)


def dismiss_persistent(id2):
    url = homeURL.read() + "/api/services/persistent_notification/create"
    #don't mind this
    data = '{"notification_id": "' + str(id2) + '"}'
    headers = {
        "Authorization": "Bearer " + tokenKey.read(),
        "content-type": "application/json",
    }
    post(url, headers=headers, data=data)

send_persistent('hoi', 'ja') #works
create_persistent('1234', 'test', 'hoi') #errors