Skip to main content

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygtaw-0.0.6.tar.gz (3.2 kB view details)

Uploaded Source

File details

Details for the file pygtaw-0.0.6.tar.gz.

File metadata

  • Download URL: pygtaw-0.0.6.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pygtaw-0.0.6.tar.gz
Algorithm Hash digest
SHA256 0712389962b734b2abb0693ef98e519f0c91d2778d723aeb32023619fd7ed566
MD5 f85fa76a4ff40edb6cc05a9e061e69cd
BLAKE2b-256 586d9b4db27082221a280674c33bb0466c0ea12745c9a4ca9ff4b7902480d794

See more details on using hashes here.

Release history Release notifications | RSS feed

0.0.9

1 file

0.0.8

1 file

0.0.7

1 file

This release

0.0.6 This release

1 file

0.0.5

1 file

0.0.4

1 file

0.0.3

1 file

0.0.2

1 file

0.0.1

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page