Skip to main content

An unofficial Google Tools wrapper

Project description

An unofficial Google Tools wrapper

GoogleTools

This library provides a simple interface for accessing Google features.

Installation

See it on Pypi
See it on Github

pip install google-tools-wrapper

Currency Conversion Usage

from google_tools import GoogleTools as tools

# `only_float=True`
>>> result = tools.currency_conversion(base_currency='USD', target_currency='BRL')
>>> print(result)
4.9024

# `only_float=False`
>>> result = tools.currency_conversion(base_currency='USD', target_currency='BRL', only_float=False)
>>> print(result) # don't looks like it on terminal, just prettyfied it
{
    'conversion': [
        '1 USD',
        '4.90 BRL'
    ],
    'float': 4.9024,
    'last_update': 'Nov 25, 4:38:00 PM UTC'
}

# setting up a benchmark
import time
def currency_conversion_test(n: int, only_float_: bool = True):
    start_timer = time.time()
    for i in range(n):
        tools.currency_conversion('USD', 'BRL', only_float=only_float_)
    finish_timer = time.time() - start_timer
    avg_time = finish_timer / n
    print(avg_time:.3f)

# 1st benchmarking:
>>> currency_conversion_test(30)
1.061 seconds per operation.

# 2nd benchmarking:
>>> currency_conversion_test(30, False)
1.172 seconds per operation.

Translater Usage

from google_tools import GoogleTools as tools

>>> result = tools.translater(source_language='pt', target_language='en', text='Ola Mundo!')
>>> print(result) # maybe it take around 5-10 seconds to respond, depends on your cpu, selenium is a bit slow
Hello World!

# setting up a benchmark
import time
def translater_test(n: int, source_language_: str, target_language_: str, text_: str):
    start_timer = time.time()
    for i in range(n):
        tools.translater(source_language_, target_language_, text_)
    finish_timer = time.time() - start_timer
    avg_time = finish_timer / n
    print(avg_time:.3f)

>>> translater_test(10, 'pt', 'en', 'Ola, me chamo Joao Zacchello!')
6.293

Disclaimer

This library is provided for educational purposes only and should not be used in production environments. It is not affiliated with Google and may not always provide accurate or up-to-date currency conversion rates. For real-time currency conversion services, please refer to official financial sources.

Project details


Download files

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

Source Distribution

google-tools-wrapper-1.5.0.tar.gz (4.0 kB view details)

Uploaded Source

File details

Details for the file google-tools-wrapper-1.5.0.tar.gz.

File metadata

  • Download URL: google-tools-wrapper-1.5.0.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for google-tools-wrapper-1.5.0.tar.gz
Algorithm Hash digest
SHA256 535f349bebdcf71a01c1516bdc3fb2a8f9cc94e0f0177eef960f909c7805a56d
MD5 2441d58a2aff18eb50282c3a40f323f2
BLAKE2b-256 691c90d87caf2e56872069f74afe724d2360653bcc4decfd671118db2bb2f366

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page