Skip to content

codevshl/data_pusher

Repository files navigation

Data Pusher

Table of Contents

Overview

Data Pusher is a Django web application designed to efficiently handle JSON data received on a server, authenticate it using an app secret token, and distribute this data across various platforms using defined webhook URLs associated with each account.

Features

  • Account Management: Create, retrieve, update, and delete accounts.
  • Destination Management: Manage webhook URLs and settings for each account.
  • Data Handling: Receive and distribute JSON data based on account settings and authentication.

Process

  1. Application Setup: Build a Django web application.
  2. APIs:
    • Account APIs: Create, Read, Update, Delete (CRUD) operations for accounts.
    • Destination APIs: CRUD operations for destinations related to accounts.
  3. Destination Retrieval: API to retrieve destinations for a given account ID.
  4. Data Reception:
    • Endpoint: /server/incoming_data accepts only POST requests in JSON format.
    • Authentication: Must include an app_secret_token in the CL-X-TOKEN header.
    • Data Distribution: Upon validating the data and token, it sends the data to the specified destinations.

Installation

Prerequisites:

  • Python 3.10 or higher
  • Django 3.x
  • Django REST Framework

Setup:

  1. Create and activate a virtual environment:

    source env/bin/activate  # On Windows use `env\Scripts\activate`
  2. Clone the repository:

    git clone https://github.com/codevshl/data_pusher.git
    
  3. Install the required dependencies:

    pip install -r requirements.txt
    
  4. Initialize the database:

    python manage.py migrate
    
  5. Run the server:

    python manage.py runserver
    

API Endpoints:

Running Tests

Running Tests for a Specific App (here data_pusher_app)

 python manage.py test data_pusher_app 

Running Specific Test Modules

python manage.py test data_pusher_app.tests.test_models

Running Specific Test Files

python manage.py test data_pusher_app.tests.test_views.test_some_views --verbosity=2

General Tips for Running Tests

Verbosity: You can control the verbosity of the test output using the --verbosity flag. Verbosity levels range from 0 to 3, where 3 is the most verbose.

Keep Database: By default, Django will create a new test database every time you run tests. If you want to keep the test database between test runs (not recommended in most cases), you can use the --keepdb flag.

Parallel Execution: If you want to speed up your test runs, you can execute tests in parallel using the --parallel flag.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages