zoukankan      html  css  js  c++  java
  • List User Messages:列出用户消息

    List User Messages:列出用户消息:
    
    
    curl -H 'Authorization: Token 0ac9e8585ef6ae51eb62c785d10a6c5102de3ff7' "http://127.0.0.1:8000/api2/user/msgs/2/"
    
    
    
    curl -d "message=this is a user msg reply from Scan" -H 'Authorization: Token 0ac9e8585ef6ae51eb62c785d10a6c5102de3ff7' "http://192.168.137.1:8000/api2/user/msgs/015208@zjtlcb.com/"
    
    
    
    [root@node0H 'Authorization: Token 0ac9e8585ef6ae51eb62c785d10a6c5102de3ff7' "http://192.168.137.1:8000/api2/user/msgs/015208@zjtlcb.com/"
    {"to_email": "015208@zjtlcb.com", "next_page": -1, "msgs": [{"attachments": [], "timestamp": 1503313050, "from_email": "99999@zjtlcb.com", "msgid": 3, "msg": "this is a user msg reply from Scan", "nickname": "99999"}, {"attachments": [], "timestamp": 1503313045, "from_email": "99999@zjtlcb.com", "msgid": 2, "msg": "this is a user msg reply from u8d75u6768u5065", "nickname": "99999"}, {"attachments": [], "timestamp": 1503313014, "from_email": "99999@zjtlcb.com", "msgid": 1, "msg": "this is a user msg reply from Scan", "nickname": "99999"}]}[root@node01 ~]# 
    
    def list_user_messages():
        token = gettoken()
        print len(token)
        token = 'Token' + ' ' + token
        print token
        url = 'http://192.168.137.1:8000/api2/user/msgs/015208@zjtlcb.com/'
        conn = httplib.HTTPConnection('127.0.0.1', 8000)
        headers = {"Authorization": token, "Accept": "application/json; indent=10", "content-type": "application/json"}
        print headers
        conn.request('GET', url, '', headers)
        response = conn.getresponse()
        res = response.read()
        print res
    if __name__ == '__main__':
        list_user_messages()
    
    C:Python27python.exe C:/Users/TLCB/PycharmProjects/untitled/mycompany/a8.py
    {"token": "0ac9e8585ef6ae51eb62c785d10a6c5102de3ff7"}
    <type 'str'>
    <type 'dict'>
    0ac9e8585ef6ae51eb62c785d10a6c5102de3ff7
    40
    Token 0ac9e8585ef6ae51eb62c785d10a6c5102de3ff7
    {'content-type': 'application/json', 'Accept': 'application/json; indent=10', 'Authorization': u'Token 0ac9e8585ef6ae51eb62c785d10a6c5102de3ff7'}
    {
            "to_email": "015208@zjtlcb.com",
            "next_page": -1,
            "msgs": [
                    {
                            "attachments": [],
                            "timestamp": 1503313050,
                            "from_email": "99999@zjtlcb.com",
                            "msgid": 3,
                            "msg": "this is a user msg reply from Scan",
                            "nickname": "99999"
                    },
                    {
                            "attachments": [],
                            "timestamp": 1503313045,
                            "from_email": "99999@zjtlcb.com",
                            "msgid": 2,
                            "msg": "this is a user msg reply from u8d75u6768u5065",
                            "nickname": "99999"
                    },
                    {
                            "attachments": [],
                            "timestamp": 1503313014,
                            "from_email": "99999@zjtlcb.com",
                            "msgid": 1,
                            "msg": "this is a user msg reply from Scan",
                            "nickname": "99999"
                    }
            ]
    }
    
    Process finished with exit code 0
    

  • 相关阅读:
    linux vps定时备份网站、数据库命令sh
    zencart批量表上传后 标题显示为网址 批量修改标题状态 SEO三要素
    robots.txt防止向黑客泄露网站的后台和隐私
    在网页中插入地图展示公司地址
    网站调用百度地图 根据地址查询经纬度
    jquery 未来元素事件示例 on() delegate() live()
    .htaccess A网站单页面301到B网站单页面
    linux批量设置部分文件与文件夹权限
    php中禁止单个ip与ip段访问的代码小结
    Spring整合ActiveMQ
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13349576.html
Copyright © 2011-2022 走看看