Giter Club home page Giter Club logo

fastapi-celery-jwt's Introduction

IP Data Retrieval and Storage System

This project is a web application built with FastAPI and Celery, designed to retrieve and store IP data from the ipdata.co API into a MySQL database.

explanation.mp4

Features

  • Fetches detailed information about an IP address from ipdata.co.
  • Stores the fetched data in a MySQL database using Peewee ORM.
  • Provides endpoints to create tasks for fetching IP data and to check the status of a task.
  • Allows retrieval of saved IP data using task IDs.

Prerequisites

Before running the application, ensure you have the following installed:

  • Python 3.x
  • pip (Python package manager)
  • MySQL server
  • RabbitMQ server (or another Celery-compatible message broker)

Installation

  1. Clone this repository:

    git clone https://github.com/yourusername/ip-data-retrieval.git
  2. Navigate to the project directory:

    cd ip-data-retrieval
    
  3. Install dependencies:

    pip install -r app/requirements.txt
    
  4. Set up your MySQL database. Create a new database and update the database configuration in app/config/database.py with your database credentials.

  5. Sign up for a free account on ipdata.co to obtain an API key. Replace 'YOUR_API_KEY' in app/tasks.py with your actual API key.

Usage

  1. Start the Celery worker:

    celery -A app.config.celery worker --loglevel=info
  2. Start the FastAPI application:

    python3 main.py
  3. Once the application is running, you can interact with it using HTTP requests. Refer to the API documentation for available endpoints and their usage.

API Documentation

Authentication Endpoints

  • POST /api/v1/signup: Register a new user account.
  • POST /api/v1/auth: Authenticate user credentials and obtain access tokens.
  • POST /api/v1/refresh: Refresh access tokens using a valid refresh token.

User Endpoints

  • GET /api/v1/user: Retrieve user details (requires authentication).

IP Data Endpoints

  • POST /api/v1/task: Create a new task to fetch IP data for a given IP address. Returns the task ID.
  • GET /api/v1/status/{task_id}: Check the status of a task and retrieve the fetched IP data if the task is completed.

Testing

For running tests, you can use the following command:

python3 -m unittest discover -s app/tests -p 'test_*.py'

fastapi-celery-jwt's People

Contributors

kazimovzaman2 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.