Repository navigation
Honor +Arg=Val and -Arg in ifttt:// URLs - #1831
Merged
caronc merged 2 commits intoOct 23, 2026
Merged
Conversation
The ifttt:// documentation describes ?+Arg=Val to add an entry to the payload and ?-Arg to drop one of value1, value2 or value3. Neither reaches the plugin. NotifyIFTTT.__init__() takes add_tokens and del_tokens (apprise/plugins/ifttt.py:140), but parse_url() returns the parsed +/- arguments as add_token and del_token (apprise/plugins/ifttt.py:355-356). Nothing accepts those names, so they are dropped and every notification goes out with the default value1, value2 and value3 payload. This hid a second bug in url(): it unpacks self.add_tokens, a dict, as key/value pairs without .items() (apprise/plugins/ifttt.py:321), so it raises ValueError as soon as add_tokens is set. A YAML entry using a "+key: value" sub-key populates add_tokens through the template_kwargs mapping, which is why such an entry fails to load today. parse_url() now returns add_tokens and del_tokens, and url() iterates add_tokens.items(). test_plugin_ifttt_url_tokens checks the payload and the url() round trip; it fails without this change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1831 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 254 255 +1
Lines 41324 41468 +144
Branches 7140 7165 +25
==========================================
+ Hits 41324 41468 +144
🚀 New features to boost your workflow:
|
Owner
|
Thank you for this PR! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Related issue (if applicable): #533
The IFTTT service page documents
?+Arg=Valto addArgto the payload and?-Argto dropvalue1,value2orvalue3(for exampleifttt://{WebhookID}@{Event}/?+NewArg=ArgValueandifttt://{WebhookID}@{Event}/?-value3). Neither one does anything:The request body is still
{"value1": "title", "value2": "body", "value3": "info"}. The log in #533 shows the same thing:?+purple=orangeis in the URL but not in theIFTTT Payload:line.Cause:
NotifyIFTTT.__init__()takesadd_tokensanddel_tokens(apprise/plugins/ifttt.py:140), the namestemplate_kwargsdeclares, butparse_url()returns the parsed+/-arguments asadd_tokenanddel_token(apprise/plugins/ifttt.py:355-356). Those land in**kwargsand are ignored.That hid a second bug.
url()builds the+arguments withfor k, v in self.add_tokens(apprise/plugins/ifttt.py:321), which unpacks the dict's keys, so it raisesValueError: too many values to unpack (expected 2)wheneveradd_tokensis set. YAML already fillsadd_tokensfrom a+key: valuesub-key, and the config loader callsurl(), so this entry fails to load today (Could not load Apprise YAML configuration entry #1, item #1):Fix:
parse_url()returnsadd_tokensanddel_tokens, andurl()iteratesself.add_tokens.items(). Both lines are needed: with only the parse side fixed, every URL with a+argument crashes inurl(), including the existing?+TemplateKey=TemplateValentry inapprise_url_tests. No documentation change is needed; this makes the documented syntax work.Checklist
+Arg=Valand-Argsyntax is unchangedtox -e lintand optionallytox -e format).tox -e qa).Testing
Added
test_plugin_ifttt_url_tokensto tests/test_plugin_ifttt.py. It loadsifttt://WebHookID@EventID/?+switch=on&-value1&-value2, checks that the request body is{"value3": "info", "switch": "on"}, then reloads the object fromurl()and checks that both token sets survive. With only apprise/plugins/ifttt.py reverted it fails withassert {} == {'switch': 'on'}.With the fix, on Python 3.12 with the
devandall-pluginsextras:pytest tests/test_plugin_ifttt.py: 3 passedpytest tests -n 8: 3836 passed, 31 skippedapprise/plugins/ifttt.pycoverage: 100% (run together with the delivery tracking and config tests)ruff check .andruff format --check .on the pinned ruff 0.15.8: passAnyone can reproduce without an IFTTT account:
python -c "from apprise import Apprise; o = Apprise.instantiate('ifttt://WebHookID@EventID/?+switch=on&-value1'); print(o.add_tokens, o.del_tokens)"On master this prints
{} []. On this branch it prints{'switch': 'on'} {'value1'}.🤖 Generated with Claude Code