def _xml_formatter(): contents = _contents_from_yaml() element = XML('discovery') return repr(element.append_dict(contents))
def generate_response(self, result, path, *, client_id, **params): try: return ( # NOQA: E124 XML( 'rss', XML( 'channel', XML('title', f'Results for {path}'), XML('description', f'With parameters "{params}"'), XML('link', f'https://{soundcloud.Client.host}{path}'), XML('atom:link', f'{self.HOST}{path}'), *[ XML( 'item', XML('title', item.title), XML('description', item.description), XML('enclosure', type='audio/mpeg', url=get_stream_url(item, client_id)), XML('link', item.permalink_url), XML('guid', item.id), ) for item in result ], ), version='2.0', **{'xmlns:atom': 'http://www.w3.org/2005/Atom'}, )) except AttributeError as attribute_error: return ExecutionException( bytes_message=str(attribute_error).encode())