Minimal wrapper to simplify the usage of the awesome ankiconnect anki addon.
Project description
py_ankiconnect
Minimal wrapper to simplify the usage of the awesome ankiconnect anki addon. I made this in about an hour to make it easy to interact with anki 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 bypython -m pip install -e .
How To
Using the command line
- You can either call it using
py_ankiconnect
orpython -m py_ankiconnect
. - To see the help:
py_ankiconnect --help
(this will either print it usingrich
if installed or using the pager.) - Examples:
- Get the list of tags:
py_ankiconnect getTags | jq
- Get info about 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)
- Get the list of tags:
Using 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())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
py_ankiconnect-1.1.0.tar.gz
(33.8 kB
view details)
Built Distribution
File details
Details for the file py_ankiconnect-1.1.0.tar.gz
.
File metadata
- Download URL: py_ankiconnect-1.1.0.tar.gz
- Upload date:
- Size: 33.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f9286137d32644776da77d1a35e56ae123ad7fb380d236f19676ccfeeebf3b5 |
|
MD5 | 8a2fcf2e0865be294a16ae95fb7113b1 |
|
BLAKE2b-256 | 4c3fbd7b9468411ec700cdcf43a089702c77e28bfec27e6de3ff546a99e6ba2d |
File details
Details for the file py_ankiconnect-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: py_ankiconnect-1.1.0-py3-none-any.whl
- Upload date:
- Size: 39.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 636e46bcf02a7d375bb07a9b8d94a2cf6ff026203813142d0e511140593a429b |
|
MD5 | 21218e08271d8a79a7515729d2d74810 |
|
BLAKE2b-256 | 8103002b84eb8b87703c8c339fe65f6efb3457095d2b27f55b89a06a58ef1a45 |