Python调用微软翻译接口

1. 海外社媒客户开发工具【免费】了,帮你从GG/FB/Ins/谷歌地图上免费获取客户

2. WhatsApp 聊天记录保险【99元/年】,聊天记录不怕丢。自带翻译、多开,号码抓取、群发

3. 外贸网站搭建、谷歌SEO、社媒运营、企业WhatsApp管理、外贸管理软件、AI应用,【联系我】

Python调用微软翻译接口,实现文字内容的自动翻译。

批量关键字翻译,批量内容的伪原创,有了这个接口都可以实现。python代码如下:

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’: ‘zh’,
‘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

需要安装python的requests模块,自己下载即可。

1. 海外社媒客户开发工具【免费】了,帮你从GG/FB/Ins/谷歌地图上免费获取客户

2. WhatsApp 聊天记录保险【99元/年】,聊天记录不怕丢。自带翻译、多开,号码抓取、群发

3. 外贸网站搭建、谷歌SEO、社媒运营、企业WhatsApp管理、外贸管理软件、AI应用,【联系我】

微信扫一扫 或 点击链接联系我

仍有疑问,点击 链接,加个 微信 好友,一起交流。

发表评论