Skip to content

advay168/medium-api-project

Repository files navigation

Medium API Project

This project provides an API to explore trending articles on Medium.
Visit the website at https://medium-api-project.herokuapp.com/

Demo.mp4

Table of Contents

  1. Instructions for running locally
    1. Prerequisites
    2. Web API
    3. Command Line Interface
  2. Technology used
  3. API Reference

Instructions for running locally

Prerequisites

  • Install git and python
  • Clone the repository
git clone https://github.com/advay168/medium-api-project.git
  • Change working directory
cd medium-api-project

Note: all further instructions assume you have changed to the correct directory (/path/to/dir/medium-api-project)

  • Create virtual environment
python -m venv .venv
  • Activate virtual environment
./.venv/Scripts/activate
  • Install requirements
pip install -r requirements.txt

Web API

  • Run the server
uvicorn src.webapi:main --port 8000
  • Visit the site at http://127.0.0.1:8000/

Command Line Interface

Prebuilt app

  • Download app.pyz from the releases
  • Run the app
python app.pyz

Run from source

  • Run the app
python -m src.cli

Building the app from source

  • Run the script made for creating a build directory, installing all requirements and creating the zipapp
python create_application.py
  • (Optional) delete the build directory
rm -r ./build/

Technology used:

  • Python 3.9
    • fastapi
    • uvicorn
    • pydantic
    • aiohttp
    • regex
    • mypy
    • flake8
    • typer
    • rich
    • zipapp

API Reference

The API reference for the webapi is available at /docs/web.md The API reference for the CLI is available at /docs/cmdline.md