This project uses FastAPI to fetch the first paragraph of Wikipedia articles based on a given article name.
- Fetches the first paragraph of any Wikipedia article
- Uses FastAPI for building the web server
- Asynchronous HTTP requests using httpx
- Data validation using Pydantic
- FastAPI for the web framework
- httpx for asynchronous HTTP requests
- Pydantic for data validation
- Poetry for dependency management
-
Clone the repository:
git clone https://github.com/yourusername/wikipedia-retriever.git cd wikipedia-retriever
-
Install Poetry if you haven't already:
curl -sSL https://install.python-poetry.org | python3 -
-
Install the dependencies:
poetry install
-
Activate the virtual environment:
poetry shell
-
Run the FastAPI server:
poetry run uvicorn main:app --reload
-
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
- Open your web browser and go to
├── 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
- 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!
:-)