mirror of
https://github.com/caronc/apprise.git
synced 2025-01-19 04:19:32 +01:00
Add global support for port= directive in URL parsing (#639)
This commit is contained in:
parent
7f7f6863c9
commit
450fc54dbb
@ -677,6 +677,9 @@ class URLBase(object):
|
|||||||
if 'cto' in results['qsd']:
|
if 'cto' in results['qsd']:
|
||||||
results['socket_connect_timeout'] = results['qsd']['cto']
|
results['socket_connect_timeout'] = results['qsd']['cto']
|
||||||
|
|
||||||
|
if 'port' in results['qsd']:
|
||||||
|
results['port'] = results['qsd']['port']
|
||||||
|
|
||||||
return results
|
return results
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -863,3 +863,30 @@ def test_plugin_email_url_parsing(mock_smtp, mock_smtp_ssl):
|
|||||||
'mailtos://user:pass123@hotmail.com')
|
'mailtos://user:pass123@hotmail.com')
|
||||||
obj = Apprise.instantiate(results, suppress_exceptions=False)
|
obj = Apprise.instantiate(results, suppress_exceptions=False)
|
||||||
assert isinstance(obj, plugins.NotifyEmail) is True
|
assert isinstance(obj, plugins.NotifyEmail) is True
|
||||||
|
|
||||||
|
#
|
||||||
|
# Test Port Over-Riding
|
||||||
|
#
|
||||||
|
results = plugins.NotifyEmail.parse_url(
|
||||||
|
"mailtos://abc:password@xyz.cn:465?"
|
||||||
|
"smtp=smtp.exmail.qq.com&mode=ssl")
|
||||||
|
obj = Apprise.instantiate(results, suppress_exceptions=False)
|
||||||
|
assert isinstance(obj, plugins.NotifyEmail) is True
|
||||||
|
|
||||||
|
# Verify our over-rides are in place
|
||||||
|
assert obj.smtp_host == 'smtp.exmail.qq.com'
|
||||||
|
assert obj.port == 465
|
||||||
|
assert obj.from_addr == 'abc@xyz.cn'
|
||||||
|
assert obj.secure_mode == 'ssl'
|
||||||
|
|
||||||
|
results = plugins.NotifyEmail.parse_url(
|
||||||
|
"mailtos://abc:password@xyz.cn?"
|
||||||
|
"smtp=smtp.exmail.qq.com&mode=ssl&port=465")
|
||||||
|
obj = Apprise.instantiate(results, suppress_exceptions=False)
|
||||||
|
assert isinstance(obj, plugins.NotifyEmail) is True
|
||||||
|
|
||||||
|
# Verify our over-rides are in place
|
||||||
|
assert obj.smtp_host == 'smtp.exmail.qq.com'
|
||||||
|
assert obj.port == 465
|
||||||
|
assert obj.from_addr == 'abc@xyz.cn'
|
||||||
|
assert obj.secure_mode == 'ssl'
|
||||||
|
Loading…
Reference in New Issue
Block a user