Google Tasks backend

I have integrated the Google Task API here.

The Calendar Project is a FastAPI-based web application that integrates with the Google Calendar API to manage events and tasks. The application provides endpoints to create, read, update, and delete events and tasks. It also includes authentication and authorization mechanisms to secure the API. The project aims to simplify event and task management by leveraging Google's robust calendar services.

Tech Stack

  • Backend: FastAPI

  • Programming Language: Python

  • Database: Not applicable (uses Google Calendar API for data storage)

  • Testing: Pytest, httpx

  • Deployment: Docker

Features Implemented

  1. Task Management:

    • Create, view, update, and delete tasks.

    • Manage task details like title, description, due date, and status.

  2. Authentication:

    • Secure API endpoints using OAuth 2.0 with Google authentication.

Swagger UI:

  • API documentation and testing interface using FastAPI's integrated Swagger UI.

API ROUTES

  • /tasks/create (POST) - Create a new task in Google Tasks.

  • /tasks/get/{task_id} (GET) - Retrieve details of a specific task using the task ID.

  • /tasks/update/{task_id} (PUT) - Update details of an existing task.

  • /tasks/delete/{task_id} (DELETE) - Delete a specific task from Google Tasks

  • few more in swagger docs

How to Start the Project

Clone the Repository:

git clone https://github.com/RazzaqShikalgar/google-calender-api/tree/main
cd google-calender-api

Install Dependencies: Using Poetry:

poetry install

Set Up Environment Variables:

Create a creds.json file in the root directory with the following content:

Run the Application:

uvicorn main:app --reload

Run the Tests:

pytest

Using Docker: Build and run the Docker container:

docker build -t fastapi-app .
docker run -d -p 8080:8080 fastapi-app
http://localhost:8080/docs #to see swagger docs

Dependencies

  • FastAPI: Web framework for building APIs with Python 3.7+ based on standard Python type hints.

  • httpx: Asynchronous HTTP client for Python.

  • pytest: Testing framework for Python.

  • python-dotenv: For loading environment variables from a creds.json file.

  • Google API Client: Client library for accessing Google APIs.

Code Snippets

from pydantic import BaseModel
from datetime import datetime

class TaskModel(BaseModel):
    title: str
    notes: str
    due: datetime
    status: str
    start: datetime
    location: str

Swagger UI Screenshots

  1. API Documentation:

  2. Create Event Endpoint:

  3. Get Event Endpoint:

0
Subscribe to my newsletter

Read articles from Razzaq Shikalgar directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Razzaq Shikalgar
Razzaq Shikalgar