Giter Club home page Giter Club logo

quick-comments's Introduction

quick-comments

A comment API using DRF that allows users to submit comments associated with a content URL and list comments per content.

Run unit tests:

python manage.py test

(Relevant) Endpoint example usage:

GET /content/

See list of all content

GET /content/<slug>/

See the details for a particular instance of content along with all comments associated with it

GET /comments/

See list of all comments

POST /comments/
{
    "username": "myuser",
    "content_url": "some-url",
    "comment": "this is my first comment"
}

Will create a comment for the content URL "some-url". If that content does not already exist, it will be created automatically.

Throttling

The API will by default throttle:

  • Any user that makes more than 20 requests per minute.
  • Any user that tries to post more than 2 comments in a minute.
  • Any user that tries to post a comment that exactly matches a comment posted within the last 24 hours.

Configuration

The defaults for the throttling can be changed by setting env variables and changing the defaults to the values you desire.

EXCESS_COMMENTS_LOCKOUT=300
EXCESS_COMMENTS_RATE=2/minute

DUPLICATE_COMMENT_LOCKOUT=60
DUPLICATE_COMMENT_HOURS=24

DEFAULT_ANON_THROTTLE_RATE=20/minute
DEFAULT_USER_THROTTLE_RATE=20/minute

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.