请求接口时,如果提示:
{
"auth": "Invalid credentials"
}
说明请求接口时的用户名和密码不正确,需要传递正确的用户名和密码
对应的 Python 示例
import requests
import json
url = "localhost:4080/api/_analyze"
payload = json.dumps({
"analyzer": "standard",
"text": "ZincSearch is a memory-save search engine for multi-purpose useage"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Basic YWRtaW4xOnBhc3M0WmluYw=='
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)