Skip to content

FastAPI, Dramatiq, Scraping, PDF generation, send to Email, send to Telegram services, Dependency Injection, Authentication, Authorization

Notifications You must be signed in to change notification settings

orynbay21/Goodreads_FastApi_Pet_Project

Repository files navigation

FastAPI pet project - Goodreads website simulation

What can this app do?

  1. You can sign up as a user
  2. Log in as a user and use the 'log in' response body as a token to get authorized. As an authorized user you can create authors, books, genres, quotes and book reviews. Without logging in you can only read the lists of authors, books, genres, quotes and book reviews that other people left.

signup

signupresponse

jwtbearer
3) After registering on our website you get a welcoming email with the pdf file of book recommendations for this month. Book recommendations are being scraped from the New York Times Bestsellers of this month. Here is the link: https://www.nytimes.com/books/best-sellers/combined-print-and-e-book-fiction/ This pdf list contains: book name, author name, book description and book cover.
Dramatiq is used here to support the background task. Scraping is used here to automate the task, reportlab library is used for pdf generation and email.mime with smtplib libraries are used to send the email to the user. email

  1. You can also join our telegram channel. After first talking to the channel it tells you your chatID, after giving us your chatID through '/send_pdf_to_tg' endpoint, it will send you that recommendations pdf in telegram channel also.
    Dramatiq is used here to support the background task.

telegram

How to start the app?

  1. Start a virtual environment virtualenv venv /venv/scripts/activate
  2. Install required packages pip install -r requirements.txt
  3. Start the database docker run --name postgres -e POSTGRES_PASSWORD=postgres -p 5432:5432 postgres alembic revision -m 'initial_migration' --autogenerate alembic upgrade head
  4. Start redis docker run -d --name redis -p 6379:6379 redis/redis-stack-server:latest
  5. Start the main app (venv) PS C:\Users\Админ\Desktop\adv backend\fast> uvicorn main:app --reload
  6. Start in a separate terminal PS C:\Users\Админ\Desktop\adv backend\fast\dramatiq_job> dramatiq main
  7. Start the test server on a separate port (venv) PS C:\Users\Админ\Desktop\adv backend\fast\test_server> uvicorn main:app --reload --port 9000

Here is how your docker should look like if everything works

docker

Here is how your swagger should look like if everything works:

swagger1

swagger2

swagger3

About

FastAPI, Dramatiq, Scraping, PDF generation, send to Email, send to Telegram services, Dependency Injection, Authentication, Authorization

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published