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

Metadata

Release files for markji 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for markji 0.1.1
File Size Uploaded
markji-0.1.1.tar.gz 21.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for markji 0.1.1
File Interpreter ABI Platform
markji-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 50.6 kB

Release files / markji-0.1.1.tar.gz

Download URL markji-0.1.1.tar.gz
Size 21.3 kB
Tags Source
SHA-256 checksum
How to use checksums
4b7b110afba3edaea889bb6e0580e3388d168a7852b956755a20800535c60514
BLAKE2b-256 checksum
How to use checksums
b5b6a28316a460a81ca12f529b0b5e9bfd0ddfbe7678a7b923b99ea61bfbcba4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.4 CPython/3.11.11 Linux/6.8.0-1021-azure

Release files / markji-0.1.1-py3-none-any.whl

Download URL markji-0.1.1-py3-none-any.whl
Size 29.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c8c98577d4472a6392460fc85b17d91f1a8ed781040cea37ee487b81f6a49594
BLAKE2b-256 checksum
How to use checksums
de7e3fee3cd400d0c74edac376623f69ef8e1348e463bd69dbaeaab9ee8a690a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.4 CPython/3.11.11 Linux/6.8.0-1021-azure

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page