Code Monkey home page Code Monkey logo

qihoo360-problem's Introduction

qihoo360-problem

Install

  1. install python3, redis
  2. pip3 install redis, tornado

Run & Test

  1. python main.py
  2. run cmd in TEST_CMDS

Apis

root_url: http://localhost:8888 method: get/post body: json encoded string api_url: different apis

Recommend to use curl or postman to call apis url = ${root_url}/${api_url}

User Profile

add user:

  • api_url: api/feed/add_user_data
  • body: {"uid":"10001","name":"zdking01","icon":"http://fs.test.com/001.jpg"}
  • responce: null

get_user:

  • api_url: api/feed/get_user_data
  • body: {"uid":"10001"}
  • responce: {"uid":"10001","name":"zdking01","icon":"http://fs.test.com/001.jpg"}

delete_user:

  • api_url: api/feed/delete_user_data
  • body: {"uid":"10001"}
  • responce: null

Feed

follow:

  • api_url: api/feed/follow
  • body: `{"uid":"10001","follow_uid":"10002"} // 10001 follows 10002
  • responce: 404 if uid/follow_uid not exists. 200 if success

unfollow: api/feed/unfollow

  • body: `{"uid":"10001","follow_uid":"10002"} // 10001 follows 10002
  • responce: 404 if uid/follow_uid not exists. 200 if success

get feed timeline:

  • api_url: api/feed/get_feed
  • body: {"uid":"10001","cursor":null}
  • responce: {timeline: timelines, new_cursor: cursor}`

for callers, cursor = null for first fetch, otherwise cursor should be new_cursor in last responce. if all timelines returned and no need to next call, cursor in responce will be null.

Each timeline has format like this:

{
    "profile": {
        "uid":"10002", 
        "name":"zdking02", 
        "icon": "http://fs.test.com/002.jpg"
    },
    "feed": {
        "feed_id": "10002.qWqxg0Moew89snLa", 
        "timestamp": 1589084823744, 
        "type": "push_commits", 
        "uid": "10001", 
        "data": {"follow_uid": "10003"}
    }
    "follow": {
        "uid":"10003", 
        "name":"zdking03", 
        "icon": "http://fs.test.com/003.jpg"
    }
}
{
    "profile": {
        "uid":"10004", 
        "name":"zdking04", 
        "icon": "http://fs.test.com/004.jpg"
    },
    "feed": {
        "feed_id": "10002.qWqxg0Moew89snLa", 
        "timestamp": 1589084823744, 
        "type": "create_fork", 
        "uid": "10001", 
        "data": {"rid": "10005.xxxxxxxxx"}
    }
    "repository": {
        "rid":"10005.xxxxxxxxx", 
        "name":"zdking05 code repository", 
        "view": 0,
        "fork": 2,
    }
}

Repository

create repository

  • api_url: api/repository/create_repository
  • body: {"uid":"10002", "name": "xxxxx"}
  • responce: {"rid": "10002.xxxxx"}

create fork

  • api_url: api/repository/create_fork
  • body: {"uid":"10003", "rid": "10002.xxxxx"}
  • responce: {"rid": "10003.xxx"}

qihoo360-problem's People

Contributors

zd08135 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.