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

Method parse_url

apprise/plugins/wxpusher.py:361–395  ·  view source on GitHub ↗

Parses the URL and returns enough arguments that can allow us to re- instantiate this object.

(url)

Source from the content-addressed store, hash-verified

359
360 @staticmethod
361 def parse_url(url):
362 """Parses the URL and returns enough arguments that can allow us to re-
363 instantiate this object."""
364 results = NotifyBase.parse_url(url, verify_host=False)
365 if not results:
366 # We're done early as we couldn't load the results
367 return results
368
369 # Get our entries; split_path() looks after unquoting content for us
370 # by default
371 results["targets"] = NotifyWxPusher.split_path(results["fullpath"])
372
373 # App Token
374 if "token" in results["qsd"] and len(results["qsd"]["token"]):
375 # Extract the App token from an argument
376 results["token"] = NotifyWxPusher.unquote(results["qsd"]["token"])
377 # Any host entry defined is actually part of the path
378 # store it's element (if defined)
379 if results["host"]:
380 results["targets"].append(
381 NotifyWxPusher.split_path(results["host"])
382 )
383
384 else:
385 # The hostname is our source number
386 results["token"] = NotifyWxPusher.unquote(results["host"])
387
388 # Support the 'to' variable so that we can support rooms this way too
389 # The 'to' makes it easier to use yaml configuration
390 if "to" in results["qsd"] and len(results["qsd"]["to"]):
391 results["targets"] += NotifyWxPusher.parse_list(
392 results["qsd"]["to"]
393 )
394
395 return results

Callers

nothing calls this directly

Calls 3

split_pathMethod · 0.80
unquoteMethod · 0.80
parse_listMethod · 0.80

Tested by

no test coverage detected