fixed translator error

This commit is contained in:
Alexander Karpov 2024-04-11 12:37:08 +03:00
parent 0fa2d34e2f
commit c6063942c2
2 changed files with 10 additions and 2 deletions

View File

@ -2,7 +2,11 @@
import re import re
import requests import requests
from deep_translator import GoogleTranslator
try:
from deep_translator import GoogleTranslator # TODO: move to another service
except requests.exceptions.JSONDecodeError:
print("Failed to initialize GoogleTranslator due to external API issues.")
from django.core.files import File from django.core.files import File
from django.db import transaction from django.db import transaction
from django.utils.text import slugify from django.utils.text import slugify

View File

@ -3,7 +3,11 @@
import requests import requests
import spotipy import spotipy
from deep_translator import GoogleTranslator
try:
from deep_translator import GoogleTranslator
except requests.exceptions.JSONDecodeError:
print("Failed to initialize GoogleTranslator due to external API issues.")
from django.conf import settings from django.conf import settings
from django.core.files import File from django.core.files import File
from django.db import transaction from django.db import transaction