ackee connector wip, mdx code fix

This commit is contained in:
tonyrewin 2022-11-14 12:57:47 +03:00
parent 5ce8899922
commit 4b2f185986
3 changed files with 48 additions and 2 deletions

45
base/ackee.py Normal file
View File

@ -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)

View File

@ -285,13 +285,13 @@ def prepare_md_body(entry):
if "title" in m:
trackname += m.get("title", "")
addon += (
'<MusicPlayer src="'
'<AudioPlayer src="'
+ m.get("fileUrl", "")
+ '" title="'
+ trackname
+ '" />\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:

View File

@ -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