Parses the URL and returns enough arguments that can allow us to re- instantiate this object.
(url)
| 299 | |
| 300 | @staticmethod |
| 301 | def parse_url(url): |
| 302 | """Parses the URL and returns enough arguments that can allow us to re- |
| 303 | instantiate this object.""" |
| 304 | |
| 305 | results = NotifyBase.parse_url(url, verify_host=False) |
| 306 | if not results: |
| 307 | # We're done early as we couldn't load the results |
| 308 | return results |
| 309 | |
| 310 | # Get our API Key |
| 311 | results["apikey"] = NotifyHttpSMS.unquote(results["user"]) |
| 312 | |
| 313 | # Support the 'from' and 'source' variable so that we can support |
| 314 | # targets this way too. |
| 315 | # The 'from' makes it easier to use yaml configuration |
| 316 | if "from" in results["qsd"] and len(results["qsd"]["from"]): |
| 317 | results["source"] = NotifyHttpSMS.unquote(results["qsd"]["from"]) |
| 318 | |
| 319 | # hostname will also be a target in this case |
| 320 | results["targets"] = [ |
| 321 | *NotifyHttpSMS.parse_phone_no(results["host"]), |
| 322 | *NotifyHttpSMS.split_path(results["fullpath"]), |
| 323 | ] |
| 324 | |
| 325 | else: |
| 326 | # store our source |
| 327 | results["source"] = NotifyHttpSMS.unquote(results["host"]) |
| 328 | |
| 329 | # store targets |
| 330 | results["targets"] = NotifyHttpSMS.split_path(results["fullpath"]) |
| 331 | |
| 332 | # Support the 'to' variable so that we can support targets this way too |
| 333 | # The 'to' makes it easier to use yaml configuration |
| 334 | if "to" in results["qsd"] and len(results["qsd"]["to"]): |
| 335 | results["targets"] += NotifyHttpSMS.parse_phone_no( |
| 336 | results["qsd"]["to"] |
| 337 | ) |
| 338 | |
| 339 | if "key" in results["qsd"] and len(results["qsd"]["key"]): |
| 340 | results["apikey"] = NotifyHttpSMS.unquote(results["qsd"]["key"]) |
| 341 | |
| 342 | return results |
nothing calls this directly
no test coverage detected