@classmethod<EOL><INDENT>def from_url(cls, path):<DEDENT>
if os.path.isfile(path):<EOL><INDENT>with open(path) as fd:<EOL><INDENT>data = fd.read()<EOL><DEDENT><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>response = urllib.urlopen(path)<EOL>if response.code >= <NUM_LIT>:<EOL><INDENT>raise RuntimeError('<STR_LIT>' % path)<EOL><DEDENT>data = response.read()<EOL>response.close()<EOL><DEDENT>except IOError:<EOL><INDENT>raise RuntimeError(<EOL>'<STR_LIT>' % path<EOL>)<EOL><DEDENT><DEDENT>return cls(json.loads(data), path)<EOL>
Instantiate a :class:`TemplateRepository` instance from the data in a
file or url

Args:
    path (str): Path or url to the json file to load

Returns:
    TemplateRepository: A new instance