我现在在python3中从azure笔记本中尝试以下代码 导入请求
# Getting the key from tab Keys on Azure portal
key = "xxxxxxxxxxx"
url4authentication = 'https://api.cognitive.microsoft.com/sts/v1.0/issueToken'
headers4authentication = {'Ocp-Apim-Subscription-Key': key}
resp4authentication = requests.post(url4authentication, headers=headers4authentication)
token = resp4authentication.text
print(token)
text="hello there how are you"
come = "en"
to = "es"
url4translate = 'https://api.microsofttranslator.com/v2/http.svc/Translate'
from xml.etree import ElementTree
response = requests.get('https://api.microsofttranslator.com/v2/http.svc', params = param)
print(response)
我得到以下错误:
^{pr2}$
作为参考,我建议您首先可以尝试参考我的答案,以获得另一个类似的SO线程Response from Microsoft Translate API in Python来解决您的问题。如果你有更多的担心,请随时告诉我。在
相关问题 更多 >
编程相关推荐