腾讯文智api

2018-07-19  本文已影响13人  Jlan
from QcloudApi.qcloudapi import QcloudApi
import json


config = {
    "Region": "sh",
    "secretId": "",
    "secretKey": "",
    "method": "get"
}


def request(params):
    try:
        service = QcloudApi(module, config)
        print(service.generateUrl(action, params))
        s = service.call(action, params)
        dejson = json.loads(s)
        print(dejson)
    except Exception as e:
        print("exception:", e)


if __name__ == "__main__":
    module = 'wenzhi'
    action = "LexicalAnalysis"
    # action = 'LexicalSynonym'
    # action = 'TextKeywords'

    params = {
        "text": "紫金山在哪里,是在南京吗",
        "code": 0x00200000,
        "type": 0
    }

    request(params)
上一篇下一篇

猜你喜欢

热点阅读