Beispiel #1
0
 def _execute(cls, data: Dict, config: List[Dict]) -> None:
     for web_hook in config:
         data = cls._pre_execute_web_hook(data=data, config=web_hook)
         try:
             if web_hook["method"] == "POST":
                 safe_request(url=web_hook["url"],
                              method=web_hook["method"],
                              json=data)
             else:
                 safe_request(url=web_hook["url"],
                              method=web_hook["method"],
                              params=data)
         except RequestException:
             logger.warning("Could not send web hook, execption.",
                            exc_info=True)
Beispiel #2
0
def _read_from_url(url: str):
    from polyaxon.utils.http import safe_request

    resp = safe_request(url)
    resp.raise_for_status()
    return _read_from_stream(resp.content.decode())