|
|
|
@ -13,6 +13,7 @@ from loguru import logger
|
|
|
|
|
def apprise_custom_api_call_wrapper(body, title, notify_type, *args, **kwargs):
|
|
|
|
|
import requests
|
|
|
|
|
import json
|
|
|
|
|
from urllib.parse import unquote_plus
|
|
|
|
|
from apprise.utils import parse_url as apprise_parse_url
|
|
|
|
|
from apprise import URLBase
|
|
|
|
|
|
|
|
|
@ -47,7 +48,7 @@ def apprise_custom_api_call_wrapper(body, title, notify_type, *args, **kwargs):
|
|
|
|
|
if results:
|
|
|
|
|
# Add our headers that the user can potentially over-ride if they wish
|
|
|
|
|
# to to our returned result set and tidy entries by unquoting them
|
|
|
|
|
headers = {URLBase.unquote(x): URLBase.unquote(y)
|
|
|
|
|
headers = {unquote_plus(x): unquote_plus(y)
|
|
|
|
|
for x, y in results['qsd+'].items()}
|
|
|
|
|
|
|
|
|
|
# https://github.com/caronc/apprise/wiki/Notify_Custom_JSON#get-parameter-manipulation
|
|
|
|
@ -55,14 +56,14 @@ def apprise_custom_api_call_wrapper(body, title, notify_type, *args, **kwargs):
|
|
|
|
|
# but here we are making straight requests, so we need todo convert this against apprise's logic
|
|
|
|
|
for k, v in results['qsd'].items():
|
|
|
|
|
if not k.strip('+-') in results['qsd+'].keys():
|
|
|
|
|
params[URLBase.unquote(k)] = URLBase.unquote(v)
|
|
|
|
|
params[unquote_plus(k)] = unquote_plus(v)
|
|
|
|
|
|
|
|
|
|
# Determine Authentication
|
|
|
|
|
auth = ''
|
|
|
|
|
if results.get('user') and results.get('password'):
|
|
|
|
|
auth = (URLBase.unquote(results.get('user')), URLBase.unquote(results.get('user')))
|
|
|
|
|
auth = (unquote_plus(results.get('user')), unquote_plus(results.get('user')))
|
|
|
|
|
elif results.get('user'):
|
|
|
|
|
auth = (URLBase.unquote(results.get('user')))
|
|
|
|
|
auth = (unquote_plus(results.get('user')))
|
|
|
|
|
|
|
|
|
|
# Try to auto-guess if it's JSON
|
|
|
|
|
h = 'application/json; charset=utf-8'
|
|
|
|
|