Skip to main content

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]]
---
英语

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.1.tar.gz (21.3 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.1-py3-none-any.whl (29.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for markji-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4b7b110afba3edaea889bb6e0580e3388d168a7852b956755a20800535c60514
MD5 3e8e235f7fc563525f097236bbafd7c6
BLAKE2b-256 b5b6a28316a460a81ca12f529b0b5e9bfd0ddfbe7678a7b923b99ea61bfbcba4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: markji-0.1.1-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.11.11 Linux/6.8.0-1021-azure

File hashes

Hashes for markji-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c8c98577d4472a6392460fc85b17d91f1a8ed781040cea37ee487b81f6a49594
MD5 37f7d33714451f5595a9035803263510
BLAKE2b-256 de7e3fee3cd400d0c74edac376623f69ef8e1348e463bd69dbaeaab9ee8a690a

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

0.1.0

2 files

Supported by

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