Skip to content

FastAPI server that uses Asyncio to retrieve the first paragraph of a Wikipedia article given the name of the article.

Notifications You must be signed in to change notification settings

dtaibeau/wikipedia_retriever

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wikipedia Retriever

This project uses FastAPI to fetch the first paragraph of Wikipedia articles based on a given article name.

Features

  • Fetches the first paragraph of any Wikipedia article
  • Uses FastAPI for building the web server
  • Asynchronous HTTP requests using httpx
  • Data validation using Pydantic

Requirements

  • FastAPI for the web framework
  • httpx for asynchronous HTTP requests
  • Pydantic for data validation
  • Poetry for dependency management

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/wikipedia-retriever.git
    cd wikipedia-retriever
  2. Install Poetry if you haven't already:

    curl -sSL https://install.python-poetry.org | python3 -
  3. Install the dependencies:

    poetry install

Usage

  1. Activate the virtual environment:

    poetry shell
  2. Run the FastAPI server:

    poetry run uvicorn main:app --reload
  3. Test the FastAPI server:

    • Open your web browser and go to http://127.0.0.1:8000/article/any-article-name
    • Or use curl:
      curl http://127.0.0.1:8000/article/any-article-name

Project Structure

├── README.md                # Project README file
├── pyproject.toml           # Poetry configuration file
├── poetry.lock              # Poetry lock file
├── .gitignore               # Git ignore file
├── main.py                  # FastAPI server script
├── client.py                # Script to fetch and print Wikipedia articles

How to Contribute

  • Fork the repository:
git clone https://github.com/yourusername/wikipedia-retriever.git
cd wikipedia-retriever
  • Create your feature branch:
git checkout -b feature/awesome_feature
  • Commit your changes:
git commit -m 'Add feature'
  • Push to branch:
git push origin feature/awesome_feature
  • Open a pull request: Go to the forked repository on GitHub and click on the "New Pull Request" button!

:-)

About

FastAPI server that uses Asyncio to retrieve the first paragraph of a Wikipedia article given the name of the article.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages