from api.api_errors import NotFoundError from api.resources import AuthenticatedResource from tracker import db class Influencer(AuthenticatedResource): def get(self, source, id): influencer = next( db.execute_to_dicts( """select source, identifier, key, name, avatar, source_url, description, last_follows, total_follow_count, recent_follow_count from setf_influencer(:source, :identifier)""", params=dict(source=source, identifier=id), ), None, ) if not influencer: raise NotFoundError return influencer