• 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
    

  • 相关阅读:
    在Asp.Net头部动态加载css和js文件的方法
    关于Ajax开发中Response的ContentType的一些问题
    C#获取存储过程的返回值
    在填写表单中输入全角数字的解决方案
    Eclipse3.7中搭建Android开发环境
    THinkPHP 获取客户端IP 与IP地址查询
    php 操作数组 (合并,拆分,追加,查找,删除等)
    HTML5 LocalStorage 本地存储
    [javascript] IE与火狐下window.event对象的区别
    今天有人问是否可以使用vs2005开发,回答了一下,记录下来
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13349576.html
Copyright © 2020-2023  润新知