Joe Gregorio | 618e63b | 2010-11-04 19:55:28 -0400 | [diff] [blame] | 1 | #!/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 | |
| 8 | Command-line application that translates |
| 9 | some text. |
| 10 | """ |
| 11 | |
| 12 | __author__ = 'jcgregorio@google.com (Joe Gregorio)' |
| 13 | |
| 14 | from apiclient.discovery import build |
| 15 | |
| 16 | import pprint |
| 17 | |
| 18 | # Uncomment the next line to get very detailed logging |
| 19 | # httplib2.debuglevel = 4 |
| 20 | |
Joe Gregorio | af276d2 | 2010-12-09 14:26:58 -0500 | [diff] [blame] | 21 | |
Joe Gregorio | 618e63b | 2010-11-04 19:55:28 -0400 | [diff] [blame] | 22 | def main(): |
| 23 | |
Joe Gregorio | 61d7e96 | 2011-02-22 22:52:07 -0500 | [diff] [blame^] | 24 | p = build('translate', 'v2', |
| 25 | developerKey='AIzaSyDRRpR3GS1F1_jKNNM9HCNd2wJQyPG3oN0') |
Joe Gregorio | 618e63b | 2010-11-04 19:55:28 -0400 | [diff] [blame] | 26 | print p.translations().list( |
Joe Gregorio | 61d7e96 | 2011-02-22 22:52:07 -0500 | [diff] [blame^] | 27 | source='en', |
| 28 | target='fr', |
| 29 | q=['flower', 'car'] |
Joe Gregorio | 618e63b | 2010-11-04 19:55:28 -0400 | [diff] [blame] | 30 | ).execute() |
| 31 | |
| 32 | if __name__ == '__main__': |
| 33 | main() |