From e5820203ec7978ae4122e15a4eca2d64d722f3c3 Mon Sep 17 00:00:00 2001 From: Puneith Kaul Date: Mon, 14 Nov 2016 11:10:36 -0800 Subject: [PATCH] added fix for the client as per new lib --- translate/cloud-client/quickstart.py | 2 +- translate/cloud-client/snippets.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/translate/cloud-client/quickstart.py b/translate/cloud-client/quickstart.py index 6aeebe2974f7..5bb4a5085bb9 100644 --- a/translate/cloud-client/quickstart.py +++ b/translate/cloud-client/quickstart.py @@ -24,7 +24,7 @@ def run_quickstart(): api_key = 'YOUR_API_KEY' # Instantiates a client - translate_client = translate.Client(api_key) + translate_client = translate.Client(api_key=api_key) # The text to translate text = u'Hello, world!' diff --git a/translate/cloud-client/snippets.py b/translate/cloud-client/snippets.py index bd8ab407136b..8a2201b8100a 100644 --- a/translate/cloud-client/snippets.py +++ b/translate/cloud-client/snippets.py @@ -73,9 +73,10 @@ def translate_text(api_key, target, text, model='base'): # Text can also be a sequence of strings, in which case this method # will return a sequence of results for each text. - result = translate_client.translate(text, - target_language=target, - model=model) + result = translate_client.translate( + text, + target_language=target, + model=model) print(u'Text: {}'.format(result['input'])) print(u'Translation: {}'.format(result['translatedText']))