Upload files in FastAPI with file validationFile upload and validation can get tricky when it comes to FastAPI as we simply cannot use pydantic to do validations for us. Let's see how to get this done from fastapi import UploadFile @app.post("/file") def upload_file(file: UploadFile): val...Sep 8, 2023 路 2 min readjayhawk24.hashnode.dev
How to implement pagination in FastAPI feat. SQLAlchemyIn this blog, I will explain how we can implement custom pagination in FastAPI without any external packages. from typing import Generic, List, TypeVar from pydantic import BaseModel, conint from pydantic.generics import GenericModel class PageParam...Mar 18, 2023 路 2 min readjayhawk24.hashnode.dev
How to auto fix lint errors in a Pull Request (isort & black)If you want to fix lint errors running on CI you can easily commit all changes that the linter has made. In this example, I will be using black and isort to lint a python repo and sort the imports in the correct order also removing any unused imports...Feb 8, 2023 路 1 min readjayhawk24.hashnode.dev
Automatically apply to jobs with this python bot.Applying to jobs can be a tedious job why not let a bot handle it? I personally love Instahyre as they don鈥檛 ask any follow-up questions and it's just one click to apply. So let's use python to do this instead. from selenium import webdriver from sel...Jan 28, 2023 路 2 min readjayhawk24.hashnode.dev
Manipulate child state from parent in React.Using refs we can invoke methods of child components from a parent in both class components as well as in functional components. This is just a workaround, recommended way is to lift the state up to the parent and then pass it through props to the ch...Jan 8, 2023 路 2 min readjayhawk24.hashnode.dev