Python library for the DeepL language translation API.

Overview

DeepL Python Library

PyPI version Supported Python versions License: MIT

The DeepL API is a language translation API that allows other computer programs to send texts and documents to DeepL's servers and receive high-quality translations. This opens a whole universe of opportunities for developers: any translation product you can imagine can now be built on top of DeepL's best-in-class translation technology.

The DeepL Python library offers a convenient way for applications written in Python to interact with the DeepL API. We intend to support all API functions with the library, though support for new features may be added to the library after they’re added to the API.

Getting an authentication key

To use the DeepL Python Library, you'll need an API authentication key. To get a key, please create an account here. You can translate up to 500,000 characters/month for free.

Installation

The library can be installed from PyPI using pip:

pip install --upgrade deepl

If you need to modify this source code, install the dependencies using poetry:

poetry install

Requirements

The library is tested with Python versions 3.6 to 3.9.

The requests module is used to perform HTTP requests; the minimum is version 2.18.

Usage

import deepl

# Create a Translator object providing your DeepL API authentication key
translator = deepl.Translator("YOUR_AUTH_KEY")

# Translate text into a target language, in this case, French
result = translator.translate_text("Hello, world!", target_lang="FR")
print(result)  # "Bonjour, le monde !"
# Note: printing or converting the result to a string uses the output text

# Translate multiple texts into British English
result = translator.translate_text(["お元気ですか?", "¿Cómo estás?"], target_lang="EN-GB")
print(result[0].text)  # "How are you?"
print(result[0].detected_source_lang)  # "JA"
print(result[1].text)  # "How are you?"
print(result[1].detected_source_lang)  # "ES"

# Translating documents
translator.translate_document_from_filepath(
    "Instruction Manual.docx",
    "Bedienungsanleitlung.docx",
    target_lang="DE",
    formality="more"
)

# Check account usage
usage = translator.get_usage()
if usage.character.limit_exceeded:
    print("Character limit exceeded.")

# Source and target languages
for language in translator.get_source_languages():
    print(f"{language.code} ({language.name})")  # Example: "DE (German)"

num_languages = sum([language.supports_formality
                     for language in translator.get_target_languages()])
print(f"{num_languages} target languages support formality parameter")

Logging

Logging can be enabled to see the HTTP-requests sent and responses received by the library. Enable and control logging using Python's logging module, for example:

import logging
logging.basicConfig()
logging.getLogger('deepl').setLevel(logging.DEBUG)

Exceptions

All module functions may raise deepl.DeepLException or one of its subclasses. If invalid arguments are provided, they may raise the standard exceptions ValueError and TypeError.

Command Line Interface

The library can be run on the command line supporting all API functions. Use the --help option for usage information:

python3 -m deepl --help

The CLI requires your DeepL authentication key specified either as the DEEPL_AUTH_KEY environment variable, or using the --auth-key option, for example:

python3 -m deepl --auth-key=YOUR_AUTH_KEY usage

Note that the --auth-key argument must appear before the command argument. The recognized commands are:

Command Description
text translate text(s)
document translate document(s)
usage print usage information for the current billing period
languages print available languages

For example, to translate text:

python3 -m deepl --auth-key=YOUR_AUTH_KEY text --to=DE "Text to be translated."

Wrap text arguments in quotes to prevent the shell from splitting sentences into words.

Development

The test suite depends on deepl-mock. Run it in another terminal while executing the tests, using port 3000. Set the mock-server listening port using the environment variable DEEPL_MOCK_SERVER_PORT.

Execute the tests using tox.

Issues

If you experience problems using the library, or would like to request a new feature, please create an issue.

Comments
  • Add filename param to Translator#translate_document() method

    Add filename param to Translator#translate_document() method

    Thanks for making this great SDK!

    When using Translator#translate_document() method with BinaryIO input_document argument, the internal translate_document_upload call fails due to the following exception:

      File "/path-to-ptyhon/lib/python3.9/site-packages/deepl/translator.py", line 827, in translate_document
        handle = self.translate_document_upload(
      File "/path-to-ptyhon/lib/python3.9/site-packages/deepl/translator.py", line 892, in translate_document_upload
        raise ValueError(
    ValueError: filename is required if uploading file content as string or bytes
    

    This pull request resolves this issue by adding a new filename argument to translate_document() method.

    opened by seratch 8
  • DocumentTranslationException

    DocumentTranslationException

    Hi there, I've been using the Deepl python package to translate the entire PDFs. I had it running for some time already and most of the time it worked perfectly. Today, I was going through the logs and found some failed cases and the error logs I've collected. I couldn't figure out what went wrong so please provide some suggestions on how to address them:

    #1:
    Traceback (most recent call last):
      File "/opt/document_translator.py", line 528, in translate_batch_docs
        target_lang=self.target_language_code)
      File "/opt/conda/lib/python3.6/site-packages/deepl/translator.py", line 780, in translate_document_from_filepath
        raise e
      File "/opt/conda/lib/python3.6/site-packages/deepl/translator.py", line 775, in translate_document_from_filepath
        glossary=glossary,
      File "/opt/conda/lib/python3.6/site-packages/deepl/translator.py", line 839, in translate_document
        "Error occurred while translating document", handle
    deepl.exceptions.DocumentTranslationException: <super: <class 'DocumentTranslationException'>, <DocumentTranslationException object>>, document request: Document ID: B54E4E5999C915EF63AACA877843C03C, key: 2B17****
    !
    
    #2:
    Traceback (most recent call last):
      File "/opt/document_translator.py", line 528, in translate_batch_docs
        target_lang=self.target_language_code)
      File "/opt/conda/lib/python3.6/site-packages/deepl/translator.py", line 780, in translate_document_from_filepath
        raise e
      File "/opt/conda/lib/python3.6/site-packages/deepl/translator.py", line 775, in translate_document_from_filepath
        glossary=glossary,
      File "/opt/conda/lib/python3.6/site-packages/deepl/translator.py", line 817, in translate_document
        glossary=glossary,
      File "/opt/conda/lib/python3.6/site-packages/deepl/translator.py", line 876, in translate_document_upload
        self._raise_for_status(status, content, json)
      File "/opt/conda/lib/python3.6/site-packages/deepl/translator.py", line 522, in _raise_for_status
        "Too many requests, DeepL servers are currently experiencing "
    deepl.exceptions.TooManyRequestsException: Too many requests, DeepL servers are currently experiencing high load, message: Too many non-downloaded documents!
    
    #3:
    Traceback (most recent call last):
      File "/opt/conda/lib/python3.6/site-packages/urllib3/connectionpool.py", line 445, in _make_request
        six.raise_from(e, None)
      File "<string>", line 3, in raise_from
      File "/opt/conda/lib/python3.6/site-packages/urllib3/connectionpool.py", line 440, in _make_request
        httplib_response = conn.getresponse()
      File "/opt/conda/lib/python3.6/http/client.py", line 1379, in getresponse
        response.begin()
      File "/opt/conda/lib/python3.6/http/client.py", line 311, in begin
        version, status, reason = self._read_status()
      File "/opt/conda/lib/python3.6/http/client.py", line 272, in _read_status
        line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
      File "/opt/conda/lib/python3.6/socket.py", line 586, in readinto
        return self._sock.recv_into(b)
      File "/opt/conda/lib/python3.6/ssl.py", line 1012, in recv_into
        return self.read(nbytes, buffer)
      File "/opt/conda/lib/python3.6/ssl.py", line 874, in read
        return self._sslobj.read(len, buffer)
      File "/opt/conda/lib/python3.6/ssl.py", line 631, in read
        v = self._sslobj.read(len, buffer)
    socket.timeout: The read operation timed out
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/opt/conda/lib/python3.6/site-packages/requests/adapters.py", line 449, in send
        timeout=timeout
      File "/opt/conda/lib/python3.6/site-packages/urllib3/connectionpool.py", line 756, in urlopen
        method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
      File "/opt/conda/lib/python3.6/site-packages/urllib3/util/retry.py", line 532, in increment
        raise six.reraise(type(error), error, _stacktrace)
      File "/opt/conda/lib/python3.6/site-packages/urllib3/packages/six.py", line 735, in reraise
        raise value
      File "/opt/conda/lib/python3.6/site-packages/urllib3/connectionpool.py", line 706, in urlopen
        chunked=chunked,
      File "/opt/conda/lib/python3.6/site-packages/urllib3/connectionpool.py", line 447, in _make_request
        self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
      File "/opt/conda/lib/python3.6/site-packages/urllib3/connectionpool.py", line 337, in _raise_timeout
        self, url, "Read timed out. (read timeout=%s)" % timeout_value
    urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='api.deepl.com', port=443): Read timed out. (read timeout=10.886348485946655)
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/opt/conda/lib/python3.6/site-packages/deepl/http_client.py", line 168, in _internal_request
        request, stream=stream, timeout=timeout, **kwargs
      File "/opt/conda/lib/python3.6/site-packages/requests/sessions.py", line 655, in send
        r = adapter.send(request, **kwargs)
      File "/opt/conda/lib/python3.6/site-packages/requests/adapters.py", line 529, in send
        raise ReadTimeout(e, request=request)
    requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='api.deepl.com', port=443): Read timed out. (read timeout=10.886348485946655)
    
    The above exception was the direct cause of the following exception:
    
    Traceback (most recent call last):
      File "/opt/document_translator.py", line 528, in translate_batch_docs
        target_lang=self.target_language_code)
      File "/opt/conda/lib/python3.6/site-packages/deepl/translator.py", line 780, in translate_document_from_filepath
        raise e
      File "/opt/conda/lib/python3.6/site-packages/deepl/translator.py", line 775, in translate_document_from_filepath
        glossary=glossary,
      File "/opt/conda/lib/python3.6/site-packages/deepl/translator.py", line 817, in translate_document
        glossary=glossary,
      File "/opt/conda/lib/python3.6/site-packages/deepl/translator.py", line 874, in translate_document_upload
        "v2/document", data=request_data, files=files
      File "/opt/conda/lib/python3.6/site-packages/deepl/translator.py", line 476, in _api_call
        **kwargs,
      File "/opt/conda/lib/python3.6/site-packages/deepl/http_client.py", line 119, in request_with_backoff
        raise exception
      File "/opt/conda/lib/python3.6/site-packages/deepl/http_client.py", line 106, in request_with_backoff
        request, stream=stream, timeout=backoff.get_timeout()
      File "/opt/conda/lib/python3.6/site-packages/deepl/http_client.py", line 184, in _internal_request
        raise ConnectionException(message, should_retry=True) from e
    deepl.exceptions.ConnectionException: Request timed out: HTTPSConnectionPool(host='api.deepl.com', port=443): Read timed out. (read timeout=10.886348485946655)
    !
    

    I'm using deepl==1.3.1 and the code I use was:

    class DocumentTranslator(object):
        def __init__(self):
            self.translator = deepl.Translator(auth_key=AUTO_TRANSLATION_KEY)
            self.target_language_code = "en-us"
    
        def translate_batch_docs(pdfs):
            for pdf in pdfs:
                translated_pdf = pdf.replace('.pdf', '_translated.pdf')
                self.translator.translate_document_from_filepath(pdf, translated_pdf, target_lang=self.target_language_code)
    
    opened by ay2456 7
  • Inappropriate Exception for queries to Ukranian

    Inappropriate Exception for queries to Ukranian

    Instead of appropriately raising DeepLException: Bad request, message: Value for 'target_lang' not supported., the request throws TooManyRequestsException: Too many requests, DeepL servers are currently experiencing high load, message: Too many requests after ~10s of sleeping. It would be much better to raise early that it is not currently supported.

    In [21]: translator.translate_text("hrdinum slava", source_lang='cs', target_lang="uk")        
    2022-08-30 12:32:47,545 deepl        INFO     Request to DeepL API method=POST url=https://api-free.deepl.com/v2/translate
    2022-08-30 12:32:47,828 deepl        INFO     Starting retry 1 for request POST https://api-free.deepl.com/v2/translate after sleeping for 0.72 seconds. 
    2022-08-30 12:32:48,711 deepl        INFO     Starting retry 2 for request POST https://api-free.deepl.com/v2/translate after sleeping for 1.39 seconds. 
    2022-08-30 12:32:50,287 deepl        INFO     Starting retry 3 for request POST https://api-free.deepl.com/v2/translate after sleeping for 2.57 seconds. 
    2022-08-30 12:32:52,963 deepl        INFO     Starting retry 4 for request POST https://api-free.deepl.com/v2/translate after sleeping for 4.27 seconds. 
    2022-08-30 12:32:57,410 deepl        INFO     Starting retry 5 for request POST https://api-free.deepl.com/v2/translate after sleeping for 4.98 seconds. 
    2022-08-30 12:33:02,605 deepl        INFO     DeepL API response status_code=429 url=https://api-free.deepl.com/v2/translate
    ---------------------------------------------------------------------------
    TooManyRequestsException                  Traceback (most recent call last)
    Input In [21], in <module>
    ----> 1 translator.translate_text("hrdinum slava", source_lang='cs', target_lang="uk")
    
    File ~/Git/Supernova/venv/lib/python3.9/site-packages/deepl/translator.py:769, in Translator.translate_text(self, text, source_lang, target_lang, split_sentences, preserve_formatting, formality, glossary, tag_handling, outline_detection, non_splitting_tags, splitting_tags, ignore_tags)
        763     request_data["ignore_tags"] = join_tags(ignore_tags)
        765 status, content, json = self._api_call(
        766     "v2/translate", data=request_data
        767 )
    --> 769 self._raise_for_status(status, content, json)
        771 translations = json.get("translations", [])
        772 output = []
    
    File ~/Git/Supernova/venv/lib/python3.9/site-packages/deepl/translator.py:560, in Translator._raise_for_status(self, status_code, content, json, glossary, downloading_document)
        558     raise DeepLException(f"Bad request{message}")
        559 elif status_code == http.HTTPStatus.TOO_MANY_REQUESTS:
    --> 560     raise TooManyRequestsException(
        561         "Too many requests, DeepL servers are currently experiencing "
        562         f"high load{message}"
        563     )
        564 elif status_code == http.HTTPStatus.SERVICE_UNAVAILABLE:
        565     if downloading_document:
    
    TooManyRequestsException: Too many requests, DeepL servers are currently experiencing high load, message: Too many requests
    
    opened by jvacek 6
  • translating xml - spaces deleted at end of text string before <b> bold

    translating xml - spaces deleted at end of text string before bold

    Hello, I am using this API to translate XML documents from Schema. Some of my text elements have bold sections and I use lxml.etree to parse and translate text and tail elements. The bold elements within text end up with the space removed in front of them. Anything I can do to keep the spaces?

    opened by vf211 6
  • Any way to get native language names from the list?

    Any way to get native language names from the list?

    For instance, in the README it shows this snippet:

    for language in translator.get_source_languages():
        print(f"{language.code} ({language.name})")  # Example: "DE (German)"
    

    It would be wonderful if the "native" translation of their language could be shown, too.

    In other words, "DE (German)" would also print "Deutsch". Most of the languages I can figure out, but not really sure what the "ZH" equivalent would be.

    I'm using the free api level, so I'm hoping that could be added to that level.

    opened by mkinney 6
  • Wrong endpoint. Use https://api.deepl.com For Deepl PRO auth key

    Wrong endpoint. Use https://api.deepl.com For Deepl PRO auth key

    Hi, When I try to use api-free key to translate text it works fine, but when I try to use Pro-key I get following error:

    translator.translate_text('abc', target_lang='en-us').text

    Traceback (most recent call last):
      File "<input>", line 1, in <module>
      File "/home/.../venv3/lib/python3.6/site-packages/deepl/translator.py", line 685, in translate_text
        self._raise_for_status(status, content, json)
      File "/home/.../venv3/lib/python3.6/site-packages/deepl/translator.py", line 501, in _raise_for_status
        f"Authorization failure, check auth_key{message}"
    deepl.exceptions.AuthorizationException: Authorization failure, check auth_key, message: Wrong endpoint. Use https://api.deepl.com
    

    Translator calls v2 API and fails with this error. But when I tried to change api_call url from v2 to v1 it worked. Is there any way to use my key with API v2 or change v2 call to v1 except for changing package source code? I'm using python3.6.14 and requests==2.25.1

    opened by ibelous 6
  • Is there anyway to check which line caused error when translating document?

    Is there anyway to check which line caused error when translating document?

    I have this error which I suspect is due to the format of a few lines in my text file. But this error is very cryptic so there is no way for me to check what caused it.

    Traceback (most recent call last): File ".\testDeepL.py", line 7, in translator.translate_document_from_filepath( File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\deepl\translator.py", line 774, in translate_document_from_filepath raise e File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\deepl\translator.py", line 764, in translate_document_from_filepath self.translate_document( File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\deepl\translator.py", line 803, in translate_document handle = self.translate_document_upload( File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\deepl\translator.py", line 858, in translate_document_upload
    self._raise_for_status(status, content, json) File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\deepl\translator.py", line 479, in _raise_for_status raise DeepLException(f"Bad request{message}")

    opened by leminhyen2 6
  • Issue with ignore_tags parameter

    Issue with ignore_tags parameter

    Hello! Running the deepl package with anvil.works (https://pypi.org/project/deepl/1.5.0/) Example code: translation_output = translator.translate_text(translation_input target_lang="EN-US", ignore_tags=x) Getting: NameError: name 'x' is not defined

    opened by roland71 5
  • translate_text_with_glossary issue

    translate_text_with_glossary issue

    Hello,

    I'm getting this issue when I try to call with a glossary:

    flask_app | File "/usr/local/lib/python3.8/site-packages/deepl/translator.py", line 745, in translate_text_with_glossary flask_app | source_lang=glossary.source_lang, flask_app | AttributeError: 'numpy.ndarray' object has no attribute 'source_lang'

    Here is my calling code: translation = client.translate_text_with_glossary(df['SourceTokenized'].tolist(), target_lang=targetLangDeeplCode, tag_handling='html', ignore_tags='ignore', split_sentences="0", preserve_formatting="1", formality=formality, glossary=glossaryId)

    In your example you are not providing any of the optional parameters. However, I need to have these in my case.

    If it can help. The same request without the glossary is working perfectly fine: translation = client.translate_text(df['SourceTokenized'].tolist(), target_lang=targetLangDeeplCode, tag_handling='html', ignore_tags='ignore', split_sentences="0", preserve_formatting="1", formality=formality)

    Thanks for the help!

    Best regards, Samuel

    opened by SamueLacombe 5
  • Can't create an account for free-api

    Can't create an account for free-api

    Hello DeepL team, thanks for a great product!

    I want to use your API to create an iOS shortcut, but I can't find how to create an account to use free API on the page from your documentation - https://www.deepl.com/pro/select-country?cta=menu-login-signup/#developer

    I don't see my country in the list, so I can't create an account. Can you help me with that?

    opened by AntonUspehov 5
  • get_usage() does not give exact character count

    get_usage() does not give exact character count

    Hi,

    If I call translator.get_usage() before and after a translation, I get the same number of character used, an even 1 000 000. Is there a way to get the exact character count?

    opened by jaixan 4
  • Allow usage of custom CA Certificates or Disable SSL verification

    Allow usage of custom CA Certificates or Disable SSL verification

    In enterprise environments it is usual to have custom "Intermediate certificates" from different data security implementations, such as ZScaler, and will cause any requests to the DeepL engine to fail due to SSL verification error.

    Usually these certificates are retrievable from the local OS (Windows Certificates Store or Linux/Mac certs file).

    This suggestion adds a new parameter to the Translator and HttpClient classes enabling the user to pass it to the verify argument of the requests.Session object.

    Note: setting the environment variables REQUESTS_CA_BUNDLE or CURL_CA_BUNDLE does not solve the issue, as requests.Session.send and requests.Session.__init__ currently ignore OS environment variables. They are only considered in direct requests without a Session via requests.request and its dependant functions such as requests.get, requests.post, etc.

    Modifications to translator.py > Translator.__init__:

    def __init__(
            self,
            auth_key: str,
            *,
            server_url: Optional[str] = None,
            proxy: Union[Dict, str, None] = None,
            **verify_ssl:bool = True,** #<--------- Custom code added -> new 'verify_ssl' parameter --------->#
            skip_language_check: bool = False,
        ):
            if not auth_key:
                raise ValueError("auth_key must not be empty")
    
            if server_url is None:
                server_url = (
                    self._DEEPL_SERVER_URL_FREE
                    if util.auth_key_is_free_account(auth_key)
                    else self._DEEPL_SERVER_URL
                )
    
            self._server_url = server_url
            self._client = http_client.HttpClient(proxy**, verify_ssl**) #<--------- Custom code added to use local certs, when given --------->#
            self.headers = {"Authorization": f"DeepL-Auth-Key {auth_key}"}
    

    Modifications to http_client.py > HttpClient.__init__:

    def __init__(self, proxy: Union[Dict, str, None] = None**, verify_ssl:bool = True**): #<--------- Custom code added -> new 'verify' parameter --------->
            self._session = requests.Session()
            
            if proxy:
                if isinstance(proxy, str):
                    proxy = {"http": proxy, "https": proxy}
                if not isinstance(proxy, dict):
                    raise ValueError(
                        "proxy may be specified as a URL string or dictionary "
                        "containing URL strings for the http and https keys."
                    )
                self._session.proxies.update(proxy)
    
            # ------------------------------------------------------- #
            # Custom code added                                       #
            # Allows usage of Local Certificates for SSL verification #
            from os import path
            if (type(verify_ssl)==bool) or ((type(verify_ssl)==str) and path.exists(verify_ssl)):
                self._session.verify = verify_ssl
            del path
            # ------------------------------------------------------- #
    
            self._session.headers = {"User-Agent": user_agent}
            pass
    
    opened by andrefloriani 0
  • Dropped words and sentences in the translation

    Dropped words and sentences in the translation

    DeepL API will sometimes drop phrases, sentences, or words in the post translation. I am assuming this issue is already known, but am adding another data point. Feel free to close this issue if it's not needed.

    Attached in the top part of the screenshot is the API leaving off "In the early nineteenth century" in the post translation. Interestingly introducing a typo seemed to "fix" the issue, in the bottom portion of the screenshot (numerous -> numberous).

    image

    the prompt: Here on the ancient road connecting Babylon to Ecbatana, Darius the Great had a bas-relief carved on a rock face to commemorate his victory over the pseudo-Smerdis who wished to seize the Persian throne. Information about the divi-sion of the Empire into satrapies is also included in the long text of inscriptions, which are written in three languages: Akkadian, Old Persian and Elamite. In the early nineteenth century, the labours of the British Sir Henry Rawlinson resulted in the decipherment of the text, making it possible to read the numerous inscribed clay tablets that were later discovered in Nineveh.

    bug 
    opened by ELanning 3
  • [Feature Request?] Ability to set a preferred gender for outputs with gendered languages

    [Feature Request?] Ability to set a preferred gender for outputs with gendered languages

    Apologies if this issue is irrelevant.

    Is there a way to specify a preferred gender for gendered languages such as French or Spanish in a way that the translation that comes up matches it?

    For instance, with preferred gender set to feminine, from english to french: Input: "I've come to this city" Output: "Je suis venue dans cette ville" (instead of "Je suis venu dans cette ville")

    Otherwise it would be very nice if this was added. In fact, this is kind of a feature request for DeepL as a whole, not just the API, but I didn't know where else to ask. I guess this would take a certain time to implement, too.

    api change 
    opened by qexat 2
  • Get detected source language from translate_document_from_filepath

    Get detected source language from translate_document_from_filepath

    I need to get the detected source language after sending a whole PDF for translation using translate_document_from_filepath. However, I quickly went through the documentation and source code and didn't find any way to do this. Is it possible?

    api change 
    opened by ay2456 1
Releases(v1.11.0)
  • v1.11.0(Sep 26, 2022)

    Added

    • Add formality options 'prefer_less' and 'prefer_more'.

    Changed

    • Requests resulting in 503 Service Unavailable errors are now retried. Attempting to download a document before translation is completed will now wait and retry (up to 5 times by default), rather than raising an exception.
    Source code(tar.gz)
    Source code(zip)
  • v1.10.0(Sep 9, 2022)

    Added

    • New language available: Ukrainian ('uk'). Add language code constant and tests.

      Note: older library versions also support new languages, this update only adds new code constant.

    Changed

    • Add note and workaround to README about Poetry error on Ubuntu 22.04.
    Source code(tar.gz)
    Source code(zip)
  • v1.9.0(Jul 7, 2022)

  • v1.8.0(Jun 10, 2022)

    Added

    • Optional filename parameter added to Translator.translate_document(), only required if uploading string or bytes containing file content.

    Changed

    • Update contributing guidelines, we can now accept Pull Requests.

    Fixed

    • Fix GitLab CI config.
    Source code(tar.gz)
    Source code(zip)
  • v1.7.0(May 18, 2022)

    Added

    • New languages available: Indonesian ('id') and Turkish ('tr'). Add language code constants and tests.

      Note: older library versions also support the new languages, this update only adds new code constants.

    • Add limit_reached and any_limit_reached properties to Usage object returned by get_usage().

    • Add Translator.translate_document_wait_until_done() to poll translation status until translation is complete or fails.

    • Add auth_key_is_free_account() utility function.

    Changed

    • Improve readme usage examples.

    Deprecated

    • Deprecate limit_exceeded and any_limit_exceeded properties of Usage object returned by get_usage(), use limit_reached and any_limit_reached instead.
    Source code(tar.gz)
    Source code(zip)
  • v1.6.0(Apr 12, 2022)

    Added

    • Add error_message property to DocumentStatus, describing the error in case of document translation failure.

    Changed

    • Improve error message if translate_text_with_glossary is called without an instance of GlossaryInfo.
    • translate_document and translate_document_from_filepath return final DocumentStatus, allowing the number of billed characters to be queried.
    Source code(tar.gz)
    Source code(zip)
  • v1.5.1(Apr 11, 2022)

  • v1.5.0(Feb 28, 2022)

    Added

    • Add support for HTML tag handling in translate_text().

    Deprecated

    • DocumentTranslationException.document_request is deprecated, use document_handle instead.
    Source code(tar.gz)
    Source code(zip)
  • v1.4.1(Feb 4, 2022)

  • v1.4.0(Jan 19, 2022)

    Added

    • Add contribution guidelines -- currently we are unable to accept Pull Requests.
    • Add --glossary-id argument for CLI document command.

    Changed

    • Improve README.
    • Raise DocumentNotReadyException when attempting to download a document before it has been translated. Previously the base class DeepLException was thrown.

    Fixed

    • Add optional filename argument to translate_document_upload() to fix uploading file content as string or bytes.
    Source code(tar.gz)
    Source code(zip)
  • v1.3.1(Nov 16, 2021)

  • v1.3.0(Nov 15, 2021)

    Added

    • Add glossary support for document translation.
    • Add proxy support.

    Fixed

    • Fix issues with parallelized tests by changing how test glossaries are created and deleted.
    Source code(tar.gz)
    Source code(zip)
  • v1.2.1(Oct 19, 2021)

    Added

    • Add support for Python 3.10.

    Fixed

    • Fix bug that caused User-Agent header to be omitted from HTTP requests.
    • Fix glossary name prefix used in unit-tests to match git repository name.
    • Add workaround for possible issue in datetime.strptime in Python 3.6.
    Source code(tar.gz)
    Source code(zip)
  • v1.2.0(Oct 7, 2021)

    Added

    • Add Translator.get_glossary_languages() to query language pairs supported for glossaries.
    • Add constants for all supported languages codes, for example: Language.GERMAN.

    Changed

    • Internal language caching and client-side checking of language codes are removed.

    Deprecated

    • Some optional arguments related to language caching are now deprecated, and will be removed in a future version:
      • Translator(): the skip_language_check argument
      • Translator.get_source_languages() and Translator.get_target_languages(): the skip_cache argument

    Fixed

    • Fix HTTP request retries for document uploads.
    Source code(tar.gz)
    Source code(zip)
  • v1.1.3(Sep 27, 2021)

Owner
DeepL
DeepL
A telegram photos or videos background remover bot

Remove BG Bot A telegram photos or videos background remover bot Variables API_HASH Your API Hash from my.telegram.org API_ID Your API ID from my.tele

ALBY 7 Dec 13, 2022
Sielzz Music adalah proyek bot musik telegram, memungkinkan Anda memutar musik di telegram grup obrolan suara.

Hi, I am: Requirements 📝 FFmpeg NodeJS nodesource.com Python 3.8 or higher PyTgCalls MongoDB Get STRING_SESSION from below: 🎖 History Features 🔮 Th

1 Nov 29, 2021
Simple python program to execute terminal commands on telegram chats directly.

Small python code which can be handy when using telegram and you don't want to use VPS again and again. By configuring the code in your VPS, You can execute commands and get your output within telegr

Veshraj Ghimire 34 Dec 05, 2022
We propose the adversarial blur attack (ABA) against visual object tracking.

ABA We propose the adversarial blur attack (ABA) against visual object tracking. The ICCV link: https://arxiv.org/abs/2107.12085 and, https://openacce

Qing Guo 13 Dec 01, 2022
This is a simple collection of instructions and scripts to accompany the computerphile video about mininet and openflow.

How to get going. This project should work on Linux or MacOS. I used Ubuntu 20.04 and provide some notes here. Note, this is certainly not intended as

Richard G. Clegg 70 Jan 02, 2023
Python3 based bittrex rest api wrapper

bittrex-rest-api This open source project was created to give an understanding of the Bittrex Rest API v1.1/v3.0 in pearl language. The sample file sh

4 Nov 15, 2022
⚡️ Get notified as soon as your next CPU, GPU, or game console is in stock

Inventory Hunter This bot helped me snag an RTX 3070... hopefully it will help you get your hands on your next CPU, GPU, or game console. Requirements

Eric Marti 1.1k Dec 26, 2022
Decryption utility for PGP Whole Disk Encryption

wdepy: Decryption and Inspection for PGP WDE Disks This is a small python tool to inspect and decrypt disk images encrypted with PGP Whole Disk Encryp

Brendan Dolan-Gavitt 17 Oct 07, 2022
A self-hosted Discord music bot.

Cassette A self-hosted Discord music bot. Requirements py-cord pynacl pytube Setup Intended to be hosted on Heroku. Fork or clone this repo. Create a

Lohan 8 Apr 28, 2022
A Telegram robot can clone medias from any chat to your own chat.

Clonebot A Telegram robot can clone medias from any chat to your own chat. Read the documentation to know how to use the bot Deploy Developer Document

Renjith Mangal 224 Dec 30, 2022
VC-Music , Playing music without bot.

VC-Userbot A Telegram Userbot to play or streaming Audio and Video songs / files in Telegram Voice Chats. It's made with PyTgCalls and Pyrogram Requir

RioProjectX 8 Aug 04, 2022
A synchronous, object oriented API wrapper for thecatapi

cats.py A synchronous, object oriented API wrapper for thecatapi Table Of Content cats.py Table Of Content Installation Usage Contributing FAQ License

Marcus 2 Feb 04, 2022
YuuScource - A Discord bot made with Pycord

Yuu A Discord bot made with Pycord Features Not much lol • Easy to use commands

kekda 9 Feb 17, 2022
NiceHash Python Library and Command Line Rest API

NiceHash Python Library and Command Line Rest API Requirements / Modules pip install requests Required data and where to get it Following data is nee

Ashlin Darius Govindasamy 2 Jan 02, 2022
Self-adjusting, auto-compounding multi-pair DCA crypto trading bot using Python, AWS Lambda & 3Commas API

Self-adjusting, auto-compounding multi-pair DCA crypto trading bot using Python, AWS Lambda & 3Commas API The following code describes how we can leve

Jozef Jaroščiak 21 Dec 07, 2022
A Simple modular tool to fetch and parse data related to the stock market.

🐒 stonks-o-fetcher A Simple modular tool to fetch and parse data related to the stock market. Getting started For the moment the only source is this

Daniele 23 May 31, 2021
Auto Filter Bot V2 With Python

How To Deploy Video Subscribe YouTube Channel Added Features Imdb posters for autofilter. Imdb rating for autofilter. Custom captions for your files.

Milas 2 Mar 25, 2022
If you only have hash, you can still operate exchange

PTH Exchange If you only have hash, you can still operate exchange This project module is the same as my other project Exchange_SSRF, This project use

Jumbo 37 Dec 26, 2022
A Bot to Track Kernel Upstreams from kernel.org and Post it on Telegram Channel

Channel Kernel Tracker is the channel where the bot will be sending the updates in. Introduction This is a Telegram Bot to Track Kernel Upstreams kern

Kartikeya Hegde 3 Oct 05, 2021
This is a script to forward forward large number of documents to another telegram channel.

ChannelForward 😇 This is a Script to Forward Large Number of Documents to Another Telegram Channel. If You Try to Forward Very Large Number of Files

Anjana Madushanka 10 Jun 08, 2021