SavchenkoValeriy / emacs-powerthesaurus

Powerthesaurus integration for Emacs
GNU General Public License v3.0
269 stars 11 forks source link

The API no longer works on custom user-agent #42

Closed natrys closed 8 months ago

natrys commented 8 months ago

Today I discovered that this package had stopped working for me. To my bafflement, it actually worked in "emacs -Q". I cranked out mitmproxy, turns out that I was setting url-user-agent to something different Emacs wide.

So technically, this is not an issue with the package, because it will probably work for most people. Just a heads up in case someone opens an issue about it. I tested it out on curl, basically this fails (with default user-agent: "curl/8.5.0", but it also doesn't work with no user agent at all) :

curl -X POST -H "Content-Type: application/json" --data @/tmp/query https://api.powerthesaurus.org

But this works:

curl -X POST -H "Content-Type: application/json" --data @/tmp/query -A "URL/Emacs Emacs/30.0.50 (nil; nil)" https://api.powerthesaurus.org

I thought this was quite amusing. Are you the maintainer of that API? I also note that in their site there is no documentation or mention about any API at all. Maybe it's being phased out.