A tiny Google Translate API wrapper written in Python. An API key is needed to use this. More information on obtaining the API key can be found on the [Google Translate API site](https://cloud.google.com/translate/).
The full list of [supported languages](https://cloud.google.com/translate/v2/using_rest#language-params).
usage
Identify your api key and make a new Client object. ` >>> from pygtaw import wrapper >>> api_key = 'ENTER_API_KEY' >>> client = wrapper.Client(api_key) ` To make the translation request: ` >>> query = 'Hello, world!' >>> target = 'Korean' >>> source = 'English' >>> translation = client.translate(query, target, source) >>> >>> print translation.translated_text 안녕하세요 ` You can send a translation request without a source as well–the Google Translate API can detect the source language: ` >>> translation = client.translate('Hello', target='Spanish') >>> print translation.translated_text Hola >>> print translation.detected_source_language English ` tests —– Currently, tests are made by making requests to Google Translate API. To run the tests, make a key file in the tests folder and make sure it’s added to .gitignore.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file pygtaw-0.0.3.tar.gz.
File metadata
- Download URL: pygtaw-0.0.3.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe32907e8d49923be9160479895af65741edff0e1c55c8d5cd8dbb8d8d0c582f
|
|
| MD5 |
f05168d5a549e8b02db2ead25f712846
|
|
| BLAKE2b-256 |
cbc2f8bf78307df6d8ed69afbdf293448833490ccf72f3bd16176321467138b9
|