Parses the URL and returns enough arguments that can allow us to re- instantiate this object.
(url)
| 852 | |
| 853 | @staticmethod |
| 854 | def parse_url(url): |
| 855 | """Parses the URL and returns enough arguments that can allow us to re- |
| 856 | instantiate this object.""" |
| 857 | results = NotifyBase.parse_url(url, verify_host=False) |
| 858 | if not results: |
| 859 | # We're done early as we couldn't load the results |
| 860 | return results |
| 861 | |
| 862 | # Set our priority |
| 863 | if "priority" in results["qsd"] and len(results["qsd"]["priority"]): |
| 864 | results["priority"] = NotifyNtfy.unquote( |
| 865 | results["qsd"]["priority"] |
| 866 | ) |
| 867 | |
| 868 | if "attach" in results["qsd"] and len(results["qsd"]["attach"]): |
| 869 | results["attach"] = NotifyNtfy.unquote(results["qsd"]["attach"]) |
| 870 | results_ = NotifyBase.parse_url(results["attach"]) |
| 871 | if results_: |
| 872 | results["filename"] = ( |
| 873 | None |
| 874 | if results_["fullpath"] |
| 875 | else basename(results_["fullpath"]) |
| 876 | ) |
| 877 | |
| 878 | if "filename" in results["qsd"] and len( |
| 879 | results["qsd"]["filename"] |
| 880 | ): |
| 881 | results["filename"] = basename( |
| 882 | NotifyNtfy.unquote(results["qsd"]["filename"]) |
| 883 | ) |
| 884 | |
| 885 | if "click" in results["qsd"] and len(results["qsd"]["click"]): |
| 886 | results["click"] = NotifyNtfy.unquote(results["qsd"]["click"]) |
| 887 | |
| 888 | if "delay" in results["qsd"] and len(results["qsd"]["delay"]): |
| 889 | results["delay"] = NotifyNtfy.unquote(results["qsd"]["delay"]) |
| 890 | |
| 891 | if "email" in results["qsd"] and len(results["qsd"]["email"]): |
| 892 | results["email"] = NotifyNtfy.unquote(results["qsd"]["email"]) |
| 893 | |
| 894 | # Support both 'xtags' (canonical) and legacy 'tags'. |
| 895 | # Storing as 'xtags' prevents the config/base parser from |
| 896 | # misinterpreting this as an apprise-level tag filter. |
| 897 | raw_xtags = ( |
| 898 | results["qsd"].get("xtags") or results["qsd"].get("tags") or "" |
| 899 | ) |
| 900 | if raw_xtags: |
| 901 | results["xtags"] = parse_list(NotifyNtfy.unquote(raw_xtags)) |
| 902 | |
| 903 | if "actions" in results["qsd"] and len(results["qsd"]["actions"]): |
| 904 | results["actions"] = NotifyNtfy.unquote(results["qsd"]["actions"]) |
| 905 | |
| 906 | # Boolean to include an image or not |
| 907 | results["include_image"] = parse_bool( |
| 908 | results["qsd"].get( |
| 909 | "image", NotifyNtfy.template_args["image"]["default"] |
| 910 | ) |
| 911 | ) |
no test coverage detected