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

Method parse_url

apprise/plugins/vonage.py:350–398  ·  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

348
349 @staticmethod
350 def parse_url(url):
351 """Parses the URL and returns enough arguments that can allow us to re-
352 instantiate this object."""
353 results = NotifyBase.parse_url(url, verify_host=False)
354 if not results:
355 # We're done early as we couldn't load the results
356 return results
357
358 # Get our entries; split_path() looks after unquoting content for us
359 # by default
360 results["targets"] = NotifyVonage.split_path(results["fullpath"])
361
362 # The hostname is our source number
363 results["source"] = NotifyVonage.unquote(results["host"])
364
365 # Get our account_side and auth_token from the user/pass config
366 results["apikey"] = NotifyVonage.unquote(results["user"])
367 results["secret"] = NotifyVonage.unquote(results["password"])
368
369 # API Key
370 if "key" in results["qsd"] and len(results["qsd"]["key"]):
371 # Extract the API Key from an argument
372 results["apikey"] = NotifyVonage.unquote(results["qsd"]["key"])
373
374 # API Secret
375 if "secret" in results["qsd"] and len(results["qsd"]["secret"]):
376 # Extract the API Secret from an argument
377 results["secret"] = NotifyVonage.unquote(results["qsd"]["secret"])
378
379 # Support the 'from' and 'source' variable so that we can support
380 # targets this way too.
381 # The 'from' makes it easier to use yaml configuration
382 if "from" in results["qsd"] and len(results["qsd"]["from"]):
383 results["source"] = NotifyVonage.unquote(results["qsd"]["from"])
384 if "source" in results["qsd"] and len(results["qsd"]["source"]):
385 results["source"] = NotifyVonage.unquote(results["qsd"]["source"])
386
387 # Support the 'ttl' variable
388 if "ttl" in results["qsd"] and len(results["qsd"]["ttl"]):
389 results["ttl"] = NotifyVonage.unquote(results["qsd"]["ttl"])
390
391 # Support the 'to' variable so that we can support rooms this way too
392 # The 'to' makes it easier to use yaml configuration
393 if "to" in results["qsd"] and len(results["qsd"]["to"]):
394 results["targets"] += NotifyVonage.parse_phone_no(
395 results["qsd"]["to"]
396 )
397
398 return results

Callers

nothing calls this directly

Calls 3

split_pathMethod · 0.80
unquoteMethod · 0.80
parse_phone_noMethod · 0.80

Tested by

no test coverage detected