Skip to main content

Markji SDK for Python

Project description

markji-py

默默记忆卡-Markji Python SDK

文档: https://hlf20010508.github.io/markji-py/

依赖

  • python >= 3.11
  • aiohttp >= 3.11.14
  • dataclasses-json >= 0.6.7

安装

pip install markji

示例

import asyncio
from markji import Markji
from markji.auth import Auth
from markji.editor import AnswerLine, AudioBuilder, ParagraphBuilder
from markji.types import LanguageCode

username = "xxxx"
password = "xxxx"


async def main():
    auth = Auth(username, password)
    token = await auth.login()
    client = Markji(token)

    folder_name = "xxxx"
    folders = await client.list_folders()
    for folder in folders:
        if folder.name == folder_name:
            break

    deck_name = "xxxx"
    decks = await client.list_decks(folder.id)
    for deck in decks:
        if deck.name == deck_name:
            break

    chapters = await client.list_chapters(deck.id)
    chapter = chapters[0]

    content = []

    word = "English"
    tts = await client.tts(word, LanguageCode.EN_US)
    word = ParagraphBuilder(AudioBuilder(tts.id, word)).heading().build()
    content.append(word)
    content.append(AnswerLine)
    content.append("英语")

    content = "\n".join(content)

    card = await client.new_card(deck.id, chapter.id, content)

    print(card.content)


if __name__ == "__main__":
    asyncio.run(main())

输出:

[P#H1#[Audio#A,ID/xxxx#English]]
---
英语

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

markji-0.1.0.tar.gz (21.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

markji-0.1.0-py3-none-any.whl (29.3 kB view details)

Uploaded Python 3

File details

Details for the file markji-0.1.0.tar.gz.

File metadata

  • Download URL: markji-0.1.0.tar.gz
  • Upload date:
  • Size: 21.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.8 Linux/6.8.0-1021-azure

File hashes

Hashes for markji-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c54b085c36876f87d7045d27c37099e945d1c170d8dd5dbb469406f4c27a3768
MD5 2e011feb6eef64bbaa6e0f0c5fe6e3a2
BLAKE2b-256 de61e8a75ad0eecb7f54cc469e8e2073531def3bb2132de18c0c1dffa57413c7

See more details on using hashes here.

File details

Details for the file markji-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: markji-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 29.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.8 Linux/6.8.0-1021-azure

File hashes

Hashes for markji-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f439934df1cff557658b2663dadddea8bb037c94f34ee45267a3de977483d5ee
MD5 302d8efa4aa8df1d7c978f3430e909ab
BLAKE2b-256 a43ac6749faaf32e012b6cbd47211726a7d1bc9a93cc73491b1dd9e0517a19c8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page