blob: 082edc4c80ad6b577bb75424e2392825dbf9b330 [file] [log] [blame]
Joe Gregorio34044bc2011-03-07 16:58:33 -05001#!/usr/bin/python2.4
2# -*- coding: utf-8 -*-
3#
4# Copyright 2010 Google Inc. All Rights Reserved.
5
6"""Simple command-line example for Translate.
7
8Command-line application that translates
9some text.
10"""
11
12__author__ = 'jcgregorio@google.com (Joe Gregorio)'
13
14import gflags
15import logging
16import pprint
17import sys
18
19from apiclient.discovery import build
20from apiclient.model import LoggingJsonModel
21
22
23FLAGS = gflags.FLAGS
Joe Gregorio49396552011-03-08 10:39:00 -050024FLAGS.dump_request_response = True
Joe Gregorio34044bc2011-03-07 16:58:33 -050025logger = logging.getLogger()
26logger.setLevel(logging.INFO)
27
28
29def main(argv):
Joe Gregorio34044bc2011-03-07 16:58:33 -050030 service = build('translate', 'v2',
Joe Gregorioafdf50b2011-03-08 09:41:52 -050031 developerKey='AIzaSyAQIKv_gwnob-YNrXV2stnY86GSGY81Zr0',
Joe Gregorio34044bc2011-03-07 16:58:33 -050032 model=LoggingJsonModel())
33 print service.translations().list(
34 source='en',
35 target='fr',
36 q=['flower', 'car']
37 ).execute()
38
39if __name__ == '__main__':
40 main(sys.argv)