Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8447477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:11:07+00:00 2026-06-10T10:11:07+00:00

I wrote small script in python to translate words from English to Russian language.

  • 0

I wrote small script in python to translate words from English to Russian language. It uses the Microsoft-Translator-Python-API for connection to Microsoft Translator API. However, there is a problem of delay – it takes up to three seconds to call API and get translation.
Does anybody know the way to make it work faster if it’s possible?
I’ll put piece of my code, just to show what am I doing here:

translator   = Translator('My-User-Id',
                            'My-Client-Secret')

current_word = subprocess.check_output(["xsel", "-o"])
translation  = translator.translate(current_word, "ru")
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T10:11:09+00:00Added an answer on June 10, 2026 at 10:11 am

    Interestingly enough, you can actually do this:

    import json
    import requests
    import urllib
    args = {
            'client_id': '',#your client id here
            'client_secret': '',#your azure secret here
            'scope': 'http://api.microsofttranslator.com',
            'grant_type': 'client_credentials'
        }
    oauth_url = 'https://datamarket.accesscontrol.windows.net/v2/OAuth2-13'
    oauth_junk = json.loads(requests.post(oauth_url,data=urllib.urlencode(args)).content)
    translation_args = {
            'text': "hello",
            'to': 'ru',
            'from': 'en'
            }
    headers={'Authorization': 'Bearer '+oauth_junk['access_token']}
    translation_url = 'http://api.microsofttranslator.com/V2/Ajax.svc/Translate?'
    translation_result = requests.get(translation_url+urllib.urlencode(translation_args),headers=headers)
    print translation_result.content
    

    and get an immediate response a bunch of times before it slows down (6-7 times with immediate response before it slows down). I haven’t used Azure that much so I’m not sure how their rate limiting works, but I’m sure you can pay to up that rate.

    (note: I grabbed bits of the above code right out of that microsoft library. just wanted to see what the logic alone behaves like)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just started with python and wrote myself a nice, small script that uses
So I've wrote a small script to download pictures from a website. It goes
I wrote a small script. It's designed to search the python directory for all
So I wrote a small python script that allows me to specify some folder
I wrote a small-ish Python script that handles nightly conversions and archiving of audio
I am write a small python script to gather some data from a database,
Backup Script Please check the link above, I wrote this small script in python.
I am writing a small python script like this: #!/usr/bin/env python from sqlite3 import
I'm trying to write a small Python script that will get query results from
I just wrote a small python script that gets me all the groups on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.