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.
The full list of supported languages.
Usage
To install: pip install pygtaw.
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.
Metadata
Release files for pygtaw 0.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pygtaw-0.0.8.tar.gz | 3.3 kB | Details |
Release files / pygtaw-0.0.8.tar.gz
| Download URL | pygtaw-0.0.8.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dd6b108d4fb3a8ba5322e28ae40dc3d47c6a9615c3b6a0baf8d12dc8da820c5f
|
|
BLAKE2b-256 checksum How to use checksums |
67fac073c8c339ce14508fc34eb757370fe6da445bfb592839753eba2ae0604f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |