Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot change Deepl API URL #6110

Closed
pavel-francirek opened this issue May 29, 2021 · 2 comments
Closed

Cannot change Deepl API URL #6110

pavel-francirek opened this issue May 29, 2021 · 2 comments

Comments

@pavel-francirek
Copy link

Describe the issue
While using Deepl free plan if I set WEBLATE_MT_DEEPL_API_URL to https://api-free.deepl.com/v2 original (paid plan) URL is still used.

I already tried

In docker-compose.override.yml set WEBLATE_MT_DEEPL_API_URL: https://api-free.deepl.com/v2/
Started docker image, run bash (docker-compose exec --user weblate weblate bash), env shows variable set but weblate auto_translate --mt deepl xxx xxx en throws traceback

To Reproduce the issue

Steps to reproduce the behavior:

  1. set WEBLATE_MT_DEEPL_API_URL: https://api-free.deepl.com/v2/ in docker-compose.override.yml
  2. docker-compose up -d
  3. docker-compose exec --user weblate weblate bash
  4. env | grep WEBLATE_MT_DEEPL_API_URL shows WEBLATE_MT_DEEPL_API_URL=https://api-free.deepl.com/v2/
  5. weblate auto_translate --mt deepl xxx xxx en

Expected behavior

Free plan URL is used

Exception traceback

[2021-05-29 22:32:21,283: WARNING/1526] Machinery error: HTTPError: 403 Client Error: Forbidden for url: https://api.deepl.com/v2/languages
[2021-05-29 22:32:21,284: ERROR/1526] Failed to fetch languages from DeepL, using defaults
[2021-05-29 22:32:21,309: WARNING/1526] Handled exception: MachineTranslationError: HTTPError('403 Client Error: Forbidden for url: https://api.deepl.com/v2/languages')
Traceback (most recent call last):
  File "/usr/local/bin/weblate", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/dist-packages/weblate/runner.py", line 34, in main
    utility.execute()
  File "/usr/local/lib/python3.7/dist-packages/django/core/management/__init__.py", line 413, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.7/dist-packages/django/core/management/base.py", line 354, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.7/dist-packages/weblate/utils/management/base.py", line 42, in execute
    return super().execute(*args, **options)
  File "/usr/local/lib/python3.7/dist-packages/django/core/management/base.py", line 398, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.7/dist-packages/weblate/trans/management/commands/auto_translate.py", line 122, in handle
    translation=translation,
  File "/usr/local/lib/python3.7/dist-packages/celery/local.py", line 188, in __call__
    return self._get_current_object()(*a, **kw)
  File "/usr/local/lib/python3.7/dist-packages/celery/app/task.py", line 388, in __call__
    return self.run(*args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/celery/app/autoretry.py", line 34, in run
    return task._orig_run(*args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/weblate/trans/tasks.py", line 389, in auto_translate
    auto.process_mt(engines, threshold)
  File "/usr/local/lib/python3.7/dist-packages/weblate/trans/autotranslate.py", line 177, in process_mt
    translations = self.fetch_mt(engines, int(threshold))
  File "/usr/local/lib/python3.7/dist-packages/weblate/trans/autotranslate.py", line 165, in fetch_mt
    threshold=threshold,
  File "/usr/local/lib/python3.7/dist-packages/weblate/machinery/base.py", line 380, in batch_translate
    translation.component.source_language, translation.language
  File "/usr/local/lib/python3.7/dist-packages/weblate/machinery/base.py", line 286, in get_languages
    raise MachineTranslationError(repr(self.supported_languages_error))
weblate.machinery.base.MachineTranslationError: HTTPError('403 Client Error: Forbidden for url: https://api.deepl.com/v2/languages')

Server configuration and status

Weblate installation: Docker

[2021-05-29 22:35:57,670: INFO/1614] configured Sentry error collection, extras: {}

  • Weblate: 4.6.2
  • Django: 3.2.2
  • siphashc: 2.1
  • translate-toolkit: 3.3.6
  • lxml: 4.6.3
  • Pillow: 8.2.0
  • bleach: 3.3.0
  • python-dateutil: 2.8.1
  • social-auth-core: 4.1.0
  • social-auth-app-django: 4.0.0
  • django-crispy-forms: 1.11.2
  • oauthlib: 3.1.0
  • django-compressor: 2.4.1
  • djangorestframework: 3.12.4
  • django-filter: 2.4.0
  • django-appconf: 1.0.4
  • user-agents: 2.2.0
  • filelock: 3.0.12
  • setuptools: 40.8.0
  • jellyfish: 0.8.2
  • openpyxl: 3.0.7
  • celery: 5.0.5
  • kombu: 5.0.2
  • translation-finder: 2.9
  • weblate-language-data: 2021.4
  • html2text: 2020.1.16
  • pycairo: 1.16.2
  • pygobject: 3.30.4
  • diff-match-patch: 20200713
  • requests: 2.25.1
  • django-redis: 4.12.1
  • hiredis: 2.0.0
  • sentry_sdk: 1.1.0
  • Cython: 0.29.23
  • misaka: 2.1.1
  • GitPython: 3.1.14
  • borgbackup: 1.1.16
  • pyparsing: 2.4.7
  • pyahocorasick: 1.4.2
  • python-redis-lock: 3.7.0
  • Python: 3.7.3
  • Git: 2.20.1
  • psycopg2: 2.8.6
  • psycopg2-binary: 2.8.6
  • phply: 1.2.5
  • chardet: 4.0.0
  • ruamel.yaml: 0.17.4
  • tesserocr: 2.5.1
  • akismet: 1.1
  • boto3: 1.17.69
  • zeep: 4.0.0
  • aeidon: 1.9
  • iniparse: 0.5
  • mysqlclient: 2.0.3
  • Mercurial: 5.8
  • git-svn: 2.20.1
  • git-review: 2.1.0
  • Redis server: 4.0.14
  • PostgreSQL server: 11.12
  • Database backends: django.db.backends.postgresql
  • Cache backends: default:RedisCache, avatar:FileBasedCache
  • Email setup: django.core.mail.backends.smtp.EmailBackend
  • OS encoding: filesystem=utf-8, default=utf-8
  • Celery: redis://cache:6379/1, redis://cache:6379/1, regular
  • Platform: Linux 5.4.0-70-generic (x86_64)`

Weblate deploy checks

$ weblate check --deploy

[2021-05-29 22:37:35,257: INFO/1673] configured Sentry error collection, extras: {}
System check identified some issues:

WARNINGS:
?: (security.W004) You have not set a value for the SECURE_HSTS_SECONDS setting. If your entire site is served only over SSL, you may want to consider setting a value and enabling HTTP Strict Transport Security. Be sure to read the documentation first; enabling HSTS carelessly can cause serious, irreversible problems.
?: (security.W008) Your SECURE_SSL_REDIRECT setting is not set to True. Unless your site should be available over both SSL and non-SSL connections, you may want to either set this setting True or configure a load balancer or reverse-proxy server to redirect all connections to HTTPS.
?: (security.W012) SESSION_COOKIE_SECURE is not set to True. Using a secure-only session cookie makes it more difficult for network traffic sniffers to hijack user sessions.

System check identified 3 issues (1 silenced).
@pavel-francirek
Copy link
Author

Sorry, I found now it is too recent change solved in #5952

@github-actions
Copy link

The issue you have reported is now resolved. If you don’t feel it’s right, please follow its labels to get a clue for further steps.

  • In case you see a similar problem, please open a separate issue.
  • If you are happy with the outcome, don’t hesitate to support Weblate by making a donation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant