diff --git a/base/ackee.py b/base/ackee.py new file mode 100644 index 00000000..c44f39de --- /dev/null +++ b/base/ackee.py @@ -0,0 +1,45 @@ +from gql import gql, Client +from gql.transport.aiohttp import AIOHTTPTransport + +# Provide a GraphQL query +query_ackee_views = gql( + """ + query getDomainsFacts { + domains { + statistics { + views { + id + count + } + pages { + id + count + created + } + } + facts { + activeVisitors + # averageViews + # averageDuration + viewsToday + viewsMonth + viewsYear + } + } + } + """ +) + + +class GraphQLClient: + # Select your transport with a defined url endpoint + transport = AIOHTTPTransport(url="https://ackee.discours.io/") + + # Create a GraphQL client using the defined transport + client = Client(transport=transport, fetch_schema_from_transport=True) + + @staticmethod + def get_views_by_slug(slug): + # Execute the query on the transport + domains = GraphQLClient.client.execute(query_ackee_views) + print(domains) diff --git a/migration/extract.py b/migration/extract.py index 48ed5d68..4ea44d04 100644 --- a/migration/extract.py +++ b/migration/extract.py @@ -285,13 +285,13 @@ def prepare_md_body(entry): if "title" in m: trackname += m.get("title", "") addon += ( - '\n' ) - body = "import MusicPlayer from '$/components/Article/MusicPlayer'\n\n" + addon + body = "import AudioPlayer from '$/components/Article/AudioPlayer'\n\n" + addon body_orig, media = extract_html(entry) if body_orig: diff --git a/requirements.txt b/requirements.txt index e1d477fc..488b636e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,6 +6,7 @@ pyjwt>=2.6.0 starlette~=0.20.4 sqlalchemy>=1.4.41 graphql-core +gql uvicorn>=0.18.3 pydantic>=1.10.2 passlib~=1.7.4