py-ankiconnect


Namepy-ankiconnect JSON
Version 1.1.0 PyPI version JSON
download
home_pagehttps://github.com/thiswillbeyourgithub/py_ankiconnect
SummaryMinimal wrapper to simplify the usage of the awesome ankiconnect anki addon.
upload_time2024-07-31 16:13:03
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseGPLv3
keywords anki flashcards ankiconnect learning cli tool spaced repetition ebbinghaus addon
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# py_ankiconnect
Minimal wrapper to simplify the usage of the **awesome** [ankiconnect](https://git.foosoft.net/alex/anki-connect) anki addon.
I made this in about an hour to make it easy to interact with [anki](https://ankitects.github.io/) from my many python projects (see my other repos), as well as from the command line.

# Installation
* `python -m pip install py-ankiconnect` or git clone followed by `python -m pip install -e .`

# How To
## Using the command line
* You can either call it using `py_ankiconnect` or `python -m py_ankiconnect`.
* To see the help: `py_ankiconnect --help` (this will either print it using `rich` if installed or using the pager.)
* Examples:
    * Get the list of tags: `py_ankiconnect getTags | jq`
    * Get info about [Clozolkor](https://github.com/thiswillbeyourgithub/Clozolkor): `py_ankiconnect findModelsByName --modelNames ["Clozolkor"] | jq`
    * You can even use pipes: `py_ankiconnect findNotes --query '*test*' | jq -c '.[0:10]' | py_ankiconnect notesInfo --notes -` (you have to use '-', if will be replaced by the content of sys.stdin)

## Using python
``` python
from py_ankiconnect import PyAnkiconnect
akc = PyAnkiconnect()
# ^ You can set a different port or host there directly:
# akc = PyAnkiconnect(default_port=your_port)

# trigger a sync:
result = akc("sync")

# Get the list of all tags:
result = akc("getTags")

# Do some more advanced stuff:
akc(
    action="changeDeck",
    params={
        "cards": [
            1502098034045,
            1502098034048,
            1502298033753
            ],
        "deck": "Japanese::JLPT N3"
        },
)

# It supports async mode. By default it will try async or sync depending on who calls it, but you can set force_async_mode to always use async.
import asyncio
akc = PyAnkiconnect(force_async_mode=True)
async def main():
    return await akc("getTags")
asyncio.run(main())

```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/thiswillbeyourgithub/py_ankiconnect",
    "name": "py-ankiconnect",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "anki, flashcards, ankiconnect, learning, cli, tool, spaced, repetition, ebbinghaus, addon",
    "author": null,
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/4c/3f/bd7b9468411ec700cdcf43a089702c77e28bfec27e6de3ff546a99e6ba2d/py_ankiconnect-1.1.0.tar.gz",
    "platform": null,
    "description": "\n# py_ankiconnect\nMinimal wrapper to simplify the usage of the **awesome** [ankiconnect](https://git.foosoft.net/alex/anki-connect) anki addon.\nI made this in about an hour to make it easy to interact with [anki](https://ankitects.github.io/) from my many python projects (see my other repos), as well as from the command line.\n\n# Installation\n* `python -m pip install py-ankiconnect` or git clone followed by `python -m pip install -e .`\n\n# How To\n## Using the command line\n* You can either call it using `py_ankiconnect` or `python -m py_ankiconnect`.\n* To see the help: `py_ankiconnect --help` (this will either print it using `rich` if installed or using the pager.)\n* Examples:\n    * Get the list of tags: `py_ankiconnect getTags | jq`\n    * Get info about [Clozolkor](https://github.com/thiswillbeyourgithub/Clozolkor): `py_ankiconnect findModelsByName --modelNames [\"Clozolkor\"] | jq`\n    * You can even use pipes: `py_ankiconnect findNotes --query '*test*' | jq -c '.[0:10]' | py_ankiconnect notesInfo --notes -` (you have to use '-', if will be replaced by the content of sys.stdin)\n\n## Using python\n``` python\nfrom py_ankiconnect import PyAnkiconnect\nakc = PyAnkiconnect()\n# ^ You can set a different port or host there directly:\n# akc = PyAnkiconnect(default_port=your_port)\n\n# trigger a sync:\nresult = akc(\"sync\")\n\n# Get the list of all tags:\nresult = akc(\"getTags\")\n\n# Do some more advanced stuff:\nakc(\n    action=\"changeDeck\",\n    params={\n        \"cards\": [\n            1502098034045,\n            1502098034048,\n            1502298033753\n            ],\n        \"deck\": \"Japanese::JLPT N3\"\n        },\n)\n\n# It supports async mode. By default it will try async or sync depending on who calls it, but you can set force_async_mode to always use async.\nimport asyncio\nakc = PyAnkiconnect(force_async_mode=True)\nasync def main():\n    return await akc(\"getTags\")\nasyncio.run(main())\n\n```\n",
    "bugtrack_url": null,
    "license": "GPLv3",
    "summary": "Minimal wrapper to simplify the usage of the awesome ankiconnect anki addon.",
    "version": "1.1.0",
    "project_urls": {
        "Homepage": "https://github.com/thiswillbeyourgithub/py_ankiconnect"
    },
    "split_keywords": [
        "anki",
        " flashcards",
        " ankiconnect",
        " learning",
        " cli",
        " tool",
        " spaced",
        " repetition",
        " ebbinghaus",
        " addon"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8103002b84eb8b87703c8c339fe65f6efb3457095d2b27f55b89a06a58ef1a45",
                "md5": "21218e08271d8a79a7515729d2d74810",
                "sha256": "636e46bcf02a7d375bb07a9b8d94a2cf6ff026203813142d0e511140593a429b"
            },
            "downloads": -1,
            "filename": "py_ankiconnect-1.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "21218e08271d8a79a7515729d2d74810",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 39278,
            "upload_time": "2024-07-31T16:12:59",
            "upload_time_iso_8601": "2024-07-31T16:12:59.354109Z",
            "url": "https://files.pythonhosted.org/packages/81/03/002b84eb8b87703c8c339fe65f6efb3457095d2b27f55b89a06a58ef1a45/py_ankiconnect-1.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4c3fbd7b9468411ec700cdcf43a089702c77e28bfec27e6de3ff546a99e6ba2d",
                "md5": "8a2fcf2e0865be294a16ae95fb7113b1",
                "sha256": "5f9286137d32644776da77d1a35e56ae123ad7fb380d236f19676ccfeeebf3b5"
            },
            "downloads": -1,
            "filename": "py_ankiconnect-1.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "8a2fcf2e0865be294a16ae95fb7113b1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 33843,
            "upload_time": "2024-07-31T16:13:03",
            "upload_time_iso_8601": "2024-07-31T16:13:03.852633Z",
            "url": "https://files.pythonhosted.org/packages/4c/3f/bd7b9468411ec700cdcf43a089702c77e28bfec27e6de3ff546a99e6ba2d/py_ankiconnect-1.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-31 16:13:03",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "thiswillbeyourgithub",
    "github_project": "py_ankiconnect",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "py-ankiconnect"
}
        
Elapsed time: 4.52018s