Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

async-google-trans-new

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-google-trans-new

google_trans_new but it is async!

  • 1.4.6
  • PyPI
  • Socket score

Maintainers
1

async_google_trans_new

PyPI - Version PyPI - Downloads

This is a library based on google_trans_new but it is async!
It's very easy to use and solve the problem that the old api which use tk value cannot be used.
This interface is for academic use only, please do not use it for commercial use.


Installation

Run this:

pip install async-google-trans-new

Basic Usage

Translate

import asyncio
import async_google_trans_new


async def coro():
    g = async_google_trans_new.AsyncTranslator()
    print(await g.translate("こんにちは、世界!","en"))

loop = asyncio.get_event_loop()
loop.run_until_complete(coro())
-> Hello world!

Advanced Usage

Translate

Multi Translate

import asyncio
from async_google_trans_new import AsyncTranslator


async def coro():
    g = AsyncTranslator()
    texts = ["こんにちは、世界!", "こんばんは、世界!", "おはよう、世界!"]
    gathers = []
    for text in texts:
    	gathers.append(g.translate(text, "en"))

    print(await asyncio.gather(*gathers))

loop = asyncio.get_event_loop()
loop.run_until_complete(coro())
-> ['Hello World! ', 'Good evening, the world! ', 'Good morning, the world! ']

Prerequisites

  • Python 3.8 (Please make GitHub issue if you can use this lib on different python version)
  • aiohttp
  • urllib3

License

Please see LICENSE.

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc