mirror of
https://github.com/caronc/apprise.git
synced 2024-11-22 08:04:02 +01:00
Issue 69: Adding Headers Support for JSON and XML
This commit is contained in:
parent
ef76996826
commit
753e36feab
3
.gitignore
vendored
3
.gitignore
vendored
@ -61,3 +61,6 @@ target/
|
||||
|
||||
#Ipython Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
#PyCharm
|
||||
.idea
|
@ -162,6 +162,7 @@ class NotifyBase(object):
|
||||
|
||||
self.user = kwargs.get('user')
|
||||
self.password = kwargs.get('password')
|
||||
self.headers = kwargs.get('headers')
|
||||
|
||||
if 'format' in kwargs:
|
||||
# Store the specified format if specified
|
||||
@ -424,4 +425,5 @@ class NotifyBase(object):
|
||||
if 'user' in results['qsd']:
|
||||
results['user'] = results['qsd']['user']
|
||||
|
||||
results['headers'] = {k[1:]: v for k, v in results['qsd'].items() if re.match(r'^-.', k)}
|
||||
return results
|
||||
|
@ -91,6 +91,9 @@ class NotifyJSON(NotifyBase):
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
|
||||
if self.headers:
|
||||
headers.update(self.headers)
|
||||
|
||||
auth = None
|
||||
if self.user:
|
||||
auth = (self.user, self.password)
|
||||
|
@ -96,6 +96,9 @@ class NotifyXML(NotifyBase):
|
||||
'Content-Type': 'application/xml'
|
||||
}
|
||||
|
||||
if self.headers:
|
||||
headers.update(self.headers)
|
||||
|
||||
re_map = {
|
||||
'{MESSAGE_TYPE}': NotifyBase.quote(notify_type),
|
||||
'{SUBJECT}': NotifyBase.quote(title),
|
||||
|
Loading…
Reference in New Issue
Block a user