Saigesp / json-translate

Translate json files with DeepL or AWS
GNU Lesser General Public License v2.1
45 stars 18 forks source link

DEEPL_API_ENDPOINT environment variable not working. #10

Closed dotfortun3-code closed 1 year ago

dotfortun3-code commented 1 year ago

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.

iparr commented 1 year ago

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?

dotfortun3-code commented 1 year ago

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.

Saigesp commented 1 year ago

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