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
    

  • 相关阅读:
    蓝牙接收苹果手机通知 ANCS协议分析
    sqlite索引的原理
    iOS 项目的编译速度提高
    苹果核
    如何将 iOS 工程打包速度提升十倍以上
    微信跳一跳 (亲测可用)
    iOS 11 适配集锦
    iOS端Mock GPS定位 —— 测试、开发、玩游戏、发朋友圈等等,你都用得上(转)
    架构、框架、模式、模块、组件、插件、控件、中间件的含义和区别
    OC基础--对象做参数在方法间传递
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13349576.html
Copyright © 2011-2022 走看看