Skip to content

Latest commit

 

History

History
72 lines (47 loc) · 1.75 KB

README.md

File metadata and controls

72 lines (47 loc) · 1.75 KB

Laptop's News Microservice

This is a microservice designed to fetch and serve news articles using FastAPI, Requests, and BeautifulSoup. It provides a simple and efficient way to retrieve news articles about laptops.

Features

  • FastAPI: Utilizes the FastAPI framework for creating a fast and modern API with automatic documentation generation.
  • Requests: Makes HTTP requests to external news sources to fetch the latest articles.
  • Beautiful Soup: Parses and extracts relevant information from the HTML content of news articles.
  • Asynchronous: Takes advantage of asynchronous programming for efficient handling of multiple requests.

Installation

  1. Clone the repository:

    git clone https://github.com/LLkaia/news-laptops-ms.git
    cd news-laptops-ms
  2. Create a virtual environment (optional but recommended):

    python -m venv venv
  3. Activate the virtual environment:

    • On Windows:

      .\venv\Scripts\activate
    • On Unix or MacOS:

      source venv/bin/activate
  4. Install the dependencies:

    pip install -r requirements.txt

Usage

  1. Run the FastAPI application:

    python main
  2. Open your web browser and navigate to http://localhost:8000/docs to access the Swagger documentation. Here, you can test the different API endpoints and see example requests and responses.

API Endpoints

  • /news/search: Search articles about laptops.

    • Example:

        http://localhost:8000/news/search?find=acer+aspire+7+review
      
  • /news/{id}: Show concrete article.

    • Example:

        http://localhost:8000/news/657c1690f253079b6f3ed074