MCPcopy
hub / github.com/caronc/apprise / parse_url

Method parse_url

apprise/plugins/dingtalk.py:336–371  ·  view source on GitHub ↗

Parses the URL and returns enough arguments that can allow us to substantiate this object.

(url)

Source from the content-addressed store, hash-verified

334
335 @staticmethod
336 def parse_url(url):
337 """Parses the URL and returns enough arguments that can allow us to
338 substantiate this object."""
339 results = NotifyBase.parse_url(url, verify_host=False)
340 if not results:
341 # We're done early as we couldn't load the results
342 return results
343
344 results["token"] = NotifyDingTalk.unquote(results["host"])
345
346 # if a user has been defined, use it's value as the secret
347 if results.get("user"):
348 results["secret"] = results.get("user")
349
350 # Get our entries; split_path() looks after unquoting content for us
351 # by default
352 results["targets"] = NotifyDingTalk.split_path(results["fullpath"])
353
354 # Support the use of the `token` keyword argument
355 if "token" in results["qsd"] and len(results["qsd"]["token"]):
356 results["token"] = NotifyDingTalk.unquote(results["qsd"]["token"])
357
358 # Support the use of the `secret` keyword argument
359 if "secret" in results["qsd"] and len(results["qsd"]["secret"]):
360 results["secret"] = NotifyDingTalk.unquote(
361 results["qsd"]["secret"]
362 )
363
364 # Support the 'to' variable so that we can support targets this way too
365 # The 'to' makes it easier to use yaml configuration
366 if "to" in results["qsd"] and len(results["qsd"]["to"]):
367 results["targets"] += NotifyDingTalk.parse_list(
368 results["qsd"]["to"]
369 )
370
371 return results

Callers

nothing calls this directly

Calls 4

unquoteMethod · 0.80
split_pathMethod · 0.80
parse_listMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected