from abc import ABC from core.models import Source from core.util import logs log = logs.get_logger("graphql") class GraphQLClient(ABC): """ GraphQL API handler. """ async def connect(self): try: source = Source.objects.get(name=self.source_name) except Source.DoesNotExist: source = Source( name=self.source_name, type=self.source_type, endpoint=self.source_endpoint, score=self.source_score, ) source.save() self.url = source.endpoint self.source = source