Skip to content

Instantly share code, notes, and snippets.

View jerry-git's full-sized avatar

Jerry Pussinen jerry-git

View GitHub Profile
@jerry-git
jerry-git / celery_error_callback_example.py
Created March 22, 2018 12:36
A simple example about how to use error callbacks in celery
"""
celery -A celery_error_callback_example.celery worker --loglevel=info
python celery_error_callback_example.py
"""
import time
from celery import Celery
celery = Celery(
@jerry-git
jerry-git / vax_app.py
Last active September 19, 2024 12:20
Simple modern Python web app
import datetime as dt
import os
import motor
from beanie import Document, Indexed, PydanticObjectId, init_beanie, operators
from fastapi import FastAPI, Response, status
from pydantic import BaseModel
app = FastAPI()
import datetime as dt
from dataclasses import dataclass, field
import apischema
import pytest
def to_timestamp(d: dt.datetime) -> int:
return int(d.timestamp())
import typing
import uuid
from dataclasses import dataclass
class InstanceWithId(typing.Protocol):
@property
def id(self) -> str:
...