louietan / anki-editor

Emacs minor mode for making Anki cards with Org
705 stars 87 forks source link

anki-edito-push-notes fail #41

Open yamatakau08 opened 5 years ago

yamatakau08 commented 5 years ago

My environment is the following.

/tmp$ uname -a
MINGW64_NT-6.1 JPC20316739 2.11.2(0.329/5/3) 2018-11-26 09:22 x86_64 Msys
(emacs-version)
"GNU Emacs 26.1 (build 1, x86_64-w64-mingw32) of 2019-02-25"
anki-editor Version: 0.3.3

and is in proxy.

/tmp$ cat anki-editor-note.org
* Idiom                                                        :vocab:idioms:
  :PROPERTIES:
  :ANKI_DECK: Default
  :ANKI_NOTE_TYPE: Basic
  :END:
** Front
   (it's) raining cats and dogs
** Back
   it's raining very hard

I open anki-editor-note.org file and set anki-editor-mode, then execute M-x anki-editor-push-notes, it fails and gets the following.

:ANKI_FAILURE_REASON: Error communicating with AnkiConnect using cURL: exited abnormally with code 43

Could you teach me what's is wrong? or teach where I put "--noproxy" option.

Absolutely curl with --noproxy option works with anki-connect and able to push notes into Anki-web.

The following the results curl execution

/tmp$ cat anki-connect-note.json
{
    "action": "addNote",
    "version": 6,
    "params": {
        "note": {
            "deckName": "Default",
            "modelName": "Basic",
            "fields": {
                "Front": "front content",
                "Back": "back content"
            },
            "options": {
                "allowDuplicate": false
            },
            "tags": [
                "yomichan"
            ],
            "audio": {
                "url": "https://assets.languagepod101.com/dictionary/japanese/audiomp3.php?kanji=猫&kana=ねこ",
                "filename": "yomichan_ねこ_猫.mp3",
                "skipHash": "7e2c2f954ef6051373ba916f000168dc",
                "fields": [
                    "Front"
                ]
            }
        }
    }
}
/tmp$ curl --noproxy localhost localhost:8765 -X POST -d @anki-connect-note.json
{"result": 1551686026571, "error": null}
louietan commented 5 years ago

This package uses request.el with curl backend to make HTTP requests, you could try to customize the variable request-curl-options for appending arguments to curl.