I believe there's a strange problem where sending Anki-Connect requests on Python+Windows takes about 2 seconds. I tried using urllib.request and the requests library, but they both get the same result (time of around 2 seconds). I sent the code for urllib.request to someone else, and they were able to reproduce the issue. This issue appears to also be present when disabling Windows defender, and downgrading to Python 8 + Anki 2.1.49.
The strangest part is that I cannot reproduce this with any other combination, whether it is JavaScript on Windows, PowerShell on Windows, Python on Linux, curl on Linux, etc.
Example code:
import urllib.request
import time
start = time.time()
x = urllib.request.urlopen(urllib.request.Request("http://localhost:8765", {}))
end = time.time()
print(x, end-start)
import requests
import time
start = time.time()
x = requests.post("http://localhost:8765", "{}")
end = time.time()
print(x, end-start)
If anyone happens to know the source of the issue, a workaround to this, or even a simple lead on why this happens in the first place, please let me know!
Hey all,
I believe there's a strange problem where sending Anki-Connect requests on Python+Windows takes about 2 seconds. I tried using
urllib.request
and therequests
library, but they both get the same result (time of around 2 seconds). I sent the code forurllib.request
to someone else, and they were able to reproduce the issue. This issue appears to also be present when disabling Windows defender, and downgrading to Python 8 + Anki 2.1.49.The strangest part is that I cannot reproduce this with any other combination, whether it is JavaScript on Windows, PowerShell on Windows, Python on Linux, curl on Linux, etc.
Example code:
If anyone happens to know the source of the issue, a workaround to this, or even a simple lead on why this happens in the first place, please let me know!