收藏
回答

如何解决NLP原子服务(情感分析)API调用后返回的是html?

求问如何解决NLP原子服务(情感分析)API调用后返回的是html?没有错误提示的文档可以查找

我的代码是:

import jwt
import os

TOKEN = "xxxxxx"
EncodingAESKey = "xxxxxx"

payload = {
    'uid': "xxxx",   # user ID
   'data': {
        'q': "恭喜小张脱单成功",
        'mode': "6class"
    }
}
signedData = jwt.encode(
    payload=payload,    # payload, 有效载体
    key=EncodingAESKey,   # 进行加密签名的密钥
    algorithm='HS256'    # 指明签名算法方式, 默认也是HS256
)

os.system(f"curl -XPOST -d 'query={signedData}' https://openai.weixin.qq.com/openapi/nlp/sentiment/{TOKEN}")


返回的结果是:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="baidu-site-verification" content="NBNudAVdvA" />
    <meta name="google-site-verification" content="u_9F5q9UrNxwO0uNw5V949s1JTovxX8x_O5f2ZIOlds" />
    <meta name="renderer" content="webkit">


    <meta charset="utf-8">
    <meta name="keywords" content="小程序开发者社区,小程序开发者论坛,小程序开发">
    <script type="text/javascript">


        window._points=[+new Date()];




        function wx_main(mod){
            window._points&&(window._points[3]=+new Date());
        };


        window.wx={
            uin:"",
            data : {
                user_name:""
            }
        };
    </script>


    <script type="text/javascript" src="https://res.wx.qq.com/wxopenforumres/zh_CN/htmledition/js/common/wx/jserr3dccb1.js"></script>
    <title>发生错误</title>
    <link href="https://res.wx.qq.com/wxopenforumres/htmledition/images/favicon318d1d.ico" rel="Shortcut Icon">
    <link rel="stylesheet" type="text/css" href="https://res.wx.qq.com/wxopenforumres/htmledition/style/base/base3ef6a2.css"/>
    <link rel="stylesheet" type="text/css" href="https://res.wx.qq.com/wxopenforumres/htmledition/style/base/lib3ca8db.css"/>
    <link rel="stylesheet" type="text/css" href="https://res.wx.qq.com/wxopenforumres/htmledition/style/base/layout_head3ef6a2.css"/>
    <link rel="stylesheet" type="text/css" href="https://res.wx.qq.com/wxopenforumres/htmledition/style/page/error/page_error3ca8db.css"/>


</head>
<body class="zh_CN">
<div class="head" id="header">
    <script type="text/javascript">


        window._points&&(window._points[1]=+new Date());
    </script>
    <div class="head_box js_head_box">
        <h1 class="logo"><a href="/community/" title="微信公众平台 开发者社区"></a></h1>
        <div class="header_ctrls js_header_ctrls">
            <ul class="header_ctrls_meta top_nav">


            </ul>


            <div class="header_ctrls_meta">
                <a target="_blank" href="https://developers.weixin.qq.com/wxaplugin?action=index&start=0&rows=20&lang=zh_CN">插件</a>
            </div>


            <div class="header_ctrls_meta">
                <a target="_blank" href="https://developers.weixin.qq.com/miniprogram/dev/index.html">文档</a>
            </div>






            <div class="header_ctrls_meta top_user_box">
                <span class="top_user_switch">
                     <img class="user_avatar" src="https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0?wx_fmt=png" alt="">
                </span>
            </div>
        </div>


    </div>


</div>
<div id="body" class="body page_error no_permission">
    <div class="container_box">
        <div class="page_error_msg">
            <div class="inner">
                        <span class="icon_wrp">
                            <i class="icon_page_error"></i>
                        </span>
                <div class="msg_content">


                    <h2>发生错误,请点击<a href='/community/'>返回首页</a></h2>


                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">


    document.getElementById('body').style.minHeight = document.documentElement.clientHeight-123+"px"
    window.onresize = function() {
        document.getElementById('body').style.minHeight = document.documentElement.clientHeight-123+"px"
    }
</script>
<div class="foot blur_row page_full" id="footer">
    <ul class="links ft">


        <li class="links_item"><a href="http://www.tencent.com/zh-cn/index.shtml" target="_blank">关于腾讯</a></li>
        <li class="links_item"><a href="https://mp.weixin.qq.com/debug/wxadoc/dev/index.html" target="_blank">文档中心</a></li>
        <li class="links_item"><a href="http://mp.weixin.qq.com/cgi-bin/opshowpage?action=dispelinfo&lang=zh_CN&begin=1&count=9" target="_blank">辟谣中心</a></li>
        <li class="links_item"><a href="http://kf.qq.com/product/wx_xcx.html" target="_blank">客服中心</a></li>
100  4728    0  4504  100   224   4504    224  0:00:01 --:--:--  0:00:01 27649
        <li class="links_item"><a href="mailto:weixinmp@qq.com" target="_blank">联系邮箱</a></li>
        <li class="links_item"><p class="copyright">Copyright &copy; 2012-2018 Tencent. All Rights Reserved.</p></li>
    </ul>
    <script type="text/javascript">


        window._points&&(window._points[2]=+new Date());
    </script>
</div>
</body>


</html>
回答关注问题邀请回答
收藏

1 个回答

登录 后发表内容