Crate dptran

Source

Structs§

DpTran
DeepL translation library. Create a new instance of DpTran with the API key. Use the translate() method to translate the text. Use the get_usage() method to get the number of characters remaining to be translated. Use the get_language_codes() method to get the language code list. Use the check_language_code() method to check the validity of the language code. Use the correct_source_language_code() method to convert the source language code to the correct language code. Use the correct_target_language_code() method to convert the target language code to the correct language code.
DpTranUsage
DeepL API usage information
character_count: Number of characters translated this month
character_limit: Maximum number of characters that can be translated this month
If the API key is pro, the character_limit is None.
EndpointUrls
DeepL API URLs

Enums§

ApiKeyType
DeepL API key type. DeepL API servers Free and Pro plans, but the endpoints are different. So we need to distinguish between the two types of API keys. Free: Free API key, which has a character limit of 500,000 characters per month. Pro: Pro API key, which has no character limit.
ConnectionError
ConnectionErrors.
It is an error that occurs when communicating with the DeepL API.
BadRequest: 400 Bad Request
Forbidden: 403 Forbidden
NotFound: 404 Not Found
RequestEntityTooLarge: 413 Request Entity Too Large
TooManyRequests: 429 Too Many Requests
UnprocessableEntity: 456 Unprocessable Entity
ServiceUnavailable: 503 Service Unavailable
CurlError: Curl Error
UnknownError: Unknown Error
DeeplAPIError
DeepL API error.
ConnectionError: Connection error occurred in the process of sending and receiving data.
JsonError: Error occurred while parsing json.
LimitError: The translation limit of your account has been reached. Consider upgrading your subscription.
GetLanguageCodesError: Could not get language codes.
DpTranError
Errors that can occur in this library.
DeeplApiError: DeepL API error
InvalidLanguageCode: Invalid language code
ApiKeyIsNotSet: API key is not set
NoTargetLanguageSpecified: No target language specified
CouldNotGetInputText: Could not get input text
LangType
Target / Source language types
used in get_language_codes()

Constants§

DEEPL_API_LANGUAGES
DEEPL_API_LANGUAGES_PRO
DEEPL_API_TRANSLATE
DEEPL_API_TRANSLATE_PRO
DEEPL_API_USAGE
DEEPL_API_USAGE_PRO

Type Aliases§

LangCode
string as language code
LangCodeName
Language code and language name