Saigesp / json-translate

Translate json files with DeepL or AWS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DEEPL_API_ENDPOINT environment variable not working.

dotfortun3-code opened this issue · comments

I can't get the DEEPL_API_ENDPOINT environment variable to work. I upgraded to the paid version of DeepL and I am unable to get the environment variable to work for the end point.

However, I opened the setting.py file and replaced https://api-free.deepl.com/v2/translate with https://api.deepl.com/v2/translate and I was able to get it to work.

Here is what my .env file looks like

DEEPL_API_ENDPOINT=https://api.deepl.com/v2/translate
DEEPL_AUTH_KEY=XXXXX
SLEEP_BETWEEN_API_CALLS=0.01
INDENTATION_DEFAULT=2
ENCODING=utf-8

Let me know if there is any more information I can provide.

commented

Same here. I had presumed this was due to being on a Mac with a slightly janky Python / .env-unfriendly setup.

What system are you on?

I am on Windows 11 with Python 3.11.3. I am not well versed in Python, but it appears the os.environ is not loaded when DEEPL_API_ENDPOINT is set.

It works if you call os.environ.get("DEEPL_API_ENDPOINT") in deepl.py vs using the DEEPL_API_ENDPOINT variable as well.

Hi @dotfortun3-code @iparr sorry to both of us, the variables were being loaded after defining the configuration. It's fixed with 2519ce6