Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
GroupDocs.Translation Cloud-Python
from groupdocstranslationcloud.configuration import Configuration
from groupdocstranslationcloud.api.storage_api import StorageApi
# enter valid client_secret and client_id
configuration = Configuration(client_secret="", client_id="")
# enter source and destination paths
src = ""
dest = ""
api = StorageApi(configuration)
api.copy_file(src, dest)
print(api.object_exists(dest))
from groupdocstranslationcloud.configuration import Configuration
from groupdocstranslationcloud.api.storage_api import StorageApi
# enter valid client_secret and client_id
configuration = Configuration(client_secret="", client_id="")
# enter path to source and destination folders
src = ""
dest = ""
api = StorageApi(configuration)
api.copy_folder(src, dest)
print(api.object_exists(dest))
from groupdocstranslationcloud.configuration import Configuration
from groupdocstranslationcloud.api.storage_api import StorageApi
# enter valid client_secret and client_id
configuration = Configuration(client_secret="", client_id="")
# enter path to folder
folder = ""
api = StorageApi(configuration)
api.create_folder(folder)
print(api.object_exists(folder))
from groupdocstranslationcloud.configuration import Configuration
from groupdocstranslationcloud.api.storage_api import StorageApi
# enter valid client_secret and client_id
configuration = Configuration(client_secret="", client_id="")
# enter path to file
path = ""
api = StorageApi(configuration)
api.delete_file(path)
print(api.object_exists(path))
from groupdocstranslationcloud.configuration import Configuration
from groupdocstranslationcloud.api.storage_api import StorageApi
# enter valid client_secret and client_id
configuration = Configuration(client_secret="", client_id="")
# enter path to folder
folder = ""
api = StorageApi(configuration)
api.delete_folder(folder)
print(api.object_exists(folder))
from groupdocstranslationcloud.configuration import Configuration
from groupdocstranslationcloud.api.storage_api import StorageApi
# enter valid client_secret and client_id
configuration = Configuration(client_secret="", client_id="")
# enter path to file on storage
path = ""
api = StorageApi(configuration)
res = api.download_file(path)
print(res)
from groupdocstranslationcloud.configuration import Configuration
from groupdocstranslationcloud.api.storage_api import StorageApi
# enter valid client_secret and client_id
configuration = Configuration(client_secret="", client_id="")
# enter path to file on storage
path = ""
api = StorageApi(configuration)
res = api.get_file_versions(path)
print(res)
from groupdocstranslationcloud.configuration import Configuration
from groupdocstranslationcloud.api.storage_api import StorageApi
# enter valid client_secret and client_id
configuration = Configuration(client_secret="", client_id="")
# enter path to folder
folder = ""
api = StorageApi(configuration)
res = api.get_files_list(folder)
print(res)
from groupdocstranslationcloud.configuration import Configuration
from groupdocstranslationcloud.api.storage_api import StorageApi
# enter valid client_secret and client_id
configuration = Configuration(client_secret="", client_id="")
# enter source and destination paths
src = ""
dest = ""
api = StorageApi(configuration)
api.move_file(src, dest)
print(api.object_exists(dest))
from groupdocstranslationcloud.configuration import Configuration
from groupdocstranslationcloud.api.storage_api import StorageApi
# enter valid client_secret and client_id
configuration = Configuration(client_secret="", client_id="")
# enter path to source and destination folders
src = ""
dest = ""
api = StorageApi(configuration)
api.move_folder(src, dest)
print(api.object_exists(dest))
from groupdocstranslationcloud.configuration import Configuration
from groupdocstranslationcloud.api.storage_api import StorageApi
# enter valid client_secret and client_id
configuration = Configuration(client_secret="", client_id="")
# enter path to file or folder on storage
path = ""
api = StorageApi(configuration)
res = api.object_exists(path)
print(res)
from groupdocstranslationcloud.configuration import Configuration
from groupdocstranslationcloud.api.storage_api import StorageApi
# enter valid client_secret and client_id
configuration = Configuration(client_secret="", client_id="")
api = StorageApi(configuration)
res = api.get_disc_usage()
print(res)
from groupdocstranslationcloud.configuration import Configuration
from groupdocstranslationcloud.api.storage_api import StorageApi
# enter valid client_secret and client_id
configuration = Configuration(client_secret="", client_id="")
# enter storage name
storage = ""
api = StorageApi(configuration)
res = api.storage_exists(storage)
print(res)
from groupdocstranslationcloud.configuration import Configuration
from groupdocstranslationcloud.api.translation_api import TranslationApi
from groupdocstranslationcloud.models.translate_text import TranslateText
from groupdocstranslationcloud.models.translate_document import TranslateDocument
# enter valid client_secret and client_id
configuration = Configuration(client_secret="", client_id="")
# enter language pair, file format (its extennsion), storage name, file name, folder(s) name,
# folder(s) where to save translated file and translated file name
pair = ""
_format = ""
outformat = ""
storage = ""
name = "t"
folder = ""
savepath = ""
savefile = ""
masters = False
elements = list()
# creating body of request
translator = TranslateDocument(pair, _format, outformat, storage, name, folder, savepath, savefile, masters, elements)
request = translator.to_string()
#perform API call
api = TranslationApi(configuration)
res = api.post_translate_document(request)
print(res.message)
from groupdocstranslationcloud.configuration import Configuration
from groupdocstranslationcloud.api.translation_api import TranslationApi
from groupdocstranslationcloud.models.translate_text import TranslateText
from groupdocstranslationcloud.models.translate_document import TranslateDocument
# enter valid client_secret and client_id
configuration = Configuration(client_secret="", client_id="")
# enter language pair and text to translate
pair = ""
text = ""
# creating body of request
translator = TranslateText(pair, text)
request = translator.to_string()
#perform API call
api = TranslationApi(configuration)
res = api.post_translate_text(request)
print(res.translation)
from groupdocstranslationcloud.configuration import Configuration
from groupdocstranslationcloud.api.storage_api import StorageApi
# enter valid client_secret and client_id
configuration = Configuration(client_secret="", client_id="")
# enter local path to file and path where to save file on storage
src = ""
dest = ""
api = StorageApi(configuration)
res = api.upload_file(dest, src)
print(res)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment