def GET(self, account): header('Content-Type', 'application/x-json-stream') try: for identity in list_identities(account): yield render_json(**identity) + "\n" except AccountNotFound, e: raise generate_http_error(404, 'AccountNotFound', e.args[0][0])
def get(self, account): """ Get all identities mapped to an account. .. :quickref: Identities; Get account idenitity mapping. :resheader Content-Type: application/x-json-stream :param account: The account identifier. :status 200: OK. :status 401: Invalid auth token. :status 404: Account not found. :statsu 406: Not Acceptable. :status 500: Database exception :returns: Line separated dicts of identities. """ try: data = "" for identity in list_identities(account): data += render_json(**identity) + "\n" return Response(data, content_type="application/x-json-stream") except AccountNotFound as error: return generate_http_error_flask(404, 'AccountNotFound', error.args[0]) except Exception as error: print(str(format_exc())) return error, 500
def GET(self, account): header('Content-Type', 'application/x-json-stream') try: for identity in list_identities(account, vo=ctx.env.get('vo')): yield render_json(**identity) + "\n" except AccountNotFound as error: raise generate_http_error(404, 'AccountNotFound', error.args[0]) except Exception as error: print(str(format_exc())) raise InternalError(error)
def generate(vo): for identity in list_identities(account, vo=vo): yield render_json(**identity) + "\n"