Topic: Api login problem

Posted under e621 Tools and Applications

tysh1 said:
I want creat script that login via api key. When I wrote in my browser https://e621.net/posts/3307?login=tysh1&api_key=... it work
But on terminal curl/wget "user agent code" "https://e621.net/posts/3307?login=tysh1&api_key=..." it say login problem.

i tested just now with:

curl --output - 'https://e621.net/posts/3307.json?login=bipface&api_key=…'

and i got 403 'access denied'.

but when i set a non-empty user-agent:

curl --user-agent 'x' --output - 'https://e621.net/posts/3307.json?login=bipface&api_key=…'

it worked fine.

There's a section on https://e621.net/help/api which mentions:

A non-empty User-Agent header is required for all requests. Please pick a descriptive User-Agent for your project.
Due to frequent abuse, default user agents for programming languages and libraries are usually blocked. Please make sure that you are defining a user agent that is in line with our policy.

so it looks like the server is specifically looking for known default user-agent strings and responding with the error to encourage you to provide a more specific one.
i recommend just testing again with a different --user-agent value; hopefully that should be all you need to do.

I tested it and it works! But I watched my old code and didnt saw any problem. Maybe I wrote wrong user agent or puted space after -.
Thanks for reply and sorry for my english.

  • 1