class_docstr: Sends a message to Telegram upon completion/failing of an experiment.
class_docstr_tok: ["Sends","a","message","to","Telegram","upon","completion\/failing","of","an","experiment","."]
docstr: Create a TelegramObserver from a given configuration file.
  
  The file can be in any format supported by Sacred
  (.json, .pickle, [.yaml]).
  It has to specify a ``token`` and a ``chat_id`` and can optionally set
  ``silent_completion``, ``started_text``, ``completed_text``,
  ``interrupted_text``, and ``failed_text``.
docstr_tok: ["Create","a","TelegramObserver","from","a","given","configuration","file",".","The","file","can","be","in","any","format","supported","by","Sacred","(",".json",",",".pickle",",","[",".yaml","]",")",".","It","has","to","specify","a","``","token","``","and","a","``","chat_id","``","and","can","optionally","set","``","silent_completion","``",",","``","started_text","``",",","``","completed_text","``",",","``","interrupted_text","``",",","and","``","failed_text","``","."]
code: def from_config(cls, filename):
      """
      Create a TelegramObserver from a given configuration file.
  
      The file can be in any format supported by Sacred
      (.json, .pickle, [.yaml]).
      It has to specify a ``token`` and a ``chat_id`` and can optionally set
      ``silent_completion``, ``started_text``, ``completed_text``,
      ``interrupted_text``, and ``failed_text``.
      """
      import telegram
  
      d = load_config_file(filename)
      request = cls.get_proxy_request(d) if "proxy_url" in d else None
  
      if "token" in d and "chat_id" in d:
          bot = telegram.Bot(d["token"], request=request)
          obs = cls(bot, **d)
      else:
          raise ValueError(
              "Telegram configuration file must contain "
              "entries for 'token' and 'chat_id'!"
          )
      for k in [
          "started_text",
          "completed_text",
          "interrupted_text",
          "failed_text",
      ]:
          if k in d:
              setattr(obs, k, d[k])
      return obs
  
file_path: sacred/sacred/observers/telegram_obs.py
imports: from sacred.observers.base import RunObserver, td_format
  from sacred.config.config_files import load_config_file
  import logging
label_desc: Use image node_id 2 for calling the TelegramObserver obj's underlying member method code with example usage: obj.from_config(cls, filename) and returns: obs