sharplab/epub-translator

DeepL returns a 403 error. My API KEY is correct, and I can access the API from curl

basashi-G opened this issue · 1 comments

As mentioned here, the same phenomenon is happening to me.

Now there is a new error: DeepL returns a 403 error. My API KEY is correct, and I can also log in to DeepL.

Originally posted by @oogleabcd in #157 (comment)

I thought :in the API key might conflict with : in the yaml syntax, so I tried escaping : by adding '', enclosing it with ", or using a numeric character reference :, but there was no change.

I used 0.6.1.RELEASE.
Here is the error code:

net.sharplab.epubtranslator.core.driver.translator.DeepLTranslatorException: 403 error is thrown: <html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx</center>
</body>
</html>

	at net.sharplab.epubtranslator.core.driver.translator.DeepLTranslator.translate(DeepLTranslator.kt:33)
	at net.sharplab.epubtranslator.core.service.EPubTranslatorServiceImpl.translateWithDeepL$lambda-4(EPubTranslatorServiceImpl.kt:183)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
	at net.sharplab.epubtranslator.core.service.EPubTranslatorServiceImpl.translateWithDeepL(EPubTranslatorServiceImpl.kt:180)
	at net.sharplab.epubtranslator.core.service.EPubTranslatorServiceImpl.translateEPubXhtmlDocument(EPubTranslatorServiceImpl.kt:56)
	at net.sharplab.epubtranslator.core.service.EPubTranslatorServiceImpl.translateEPubXhtmlString(EPubTranslatorServiceImpl.kt:42)
	at net.sharplab.epubtranslator.core.service.EPubTranslatorServiceImpl.translate(EPubTranslatorServiceImpl.kt:29)
	at net.sharplab.epubtranslator.app.service.EPubTranslatorAppServiceImpl.translateEPubFile(EPubTranslatorAppServiceImpl.kt:12)
	at net.sharplab.epubtranslator.app.cli.EPubTranslatorCli.run(EPubTranslatorCli.kt:29)
	at picocli.CommandLine.executeUserObject(CommandLine.java:1939)
	at picocli.CommandLine.access$1300(CommandLine.java:145)
	at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2358)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2352)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2314)
	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
	at picocli.CommandLine$RunLast.execute(CommandLine.java:2316)
	at io.quarkus.picocli.runtime.PicocliRunner$EventExecutionStrategy.execute(PicocliRunner.java:26)
	at picocli.CommandLine.execute(CommandLine.java:2078)
	at io.quarkus.picocli.runtime.PicocliRunner.run(PicocliRunner.java:40)
	at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:125)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:67)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:41)
	at io.quarkus.runner.GeneratedMain.main(Unknown Source)
Caused by: net.sharplab.deepl4j.client.ApiException: <html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx</center>
</body>
</html>

	at net.sharplab.deepl4j.client.ApiClient.processResponse(ApiClient.java:842)
	at net.sharplab.deepl4j.client.ApiClient.invokeAPI(ApiClient.java:929)
	at net.sharplab.deepl4j.DeepLApi.translateTexts(DeepLApi.java:694)
	at net.sharplab.epubtranslator.core.driver.translator.DeepLTranslator.translate(DeepLTranslator.kt:29)
	... 22 more

Instead of using the JAR file of the latest release, I used a JAR file built from the latest source code. The translation was successful with none of the errors I mentioned. Thanks for the great software.