- Arrow: Better dates & times for Python
- PyPattyrn: A simple library for implementing common design patterns.
- zerorpc: Like grpc but using ZeroMQ and MessagePack.
- boltons: Boltons is a set of pure-Python utilities in the same spirit as — and yet conspicuously missing from — the standard library.
- schedule: Python job scheduling for humans.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import secrets | |
from datetime import timedelta | |
import pytest | |
from fastapi import FastAPI | |
from fastapi.testclient import TestClient | |
from fastapp import settings, crud | |
from sqlalchemy import create_engine | |
from sqlalchemy.engine import Engine | |
from sqlalchemy.orm import Session, sessionmaker |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# vim:fenc=utf-8 | |
# | |
# Copyright © 2020 Tim Hughes <[email protected]> | |
# | |
# Distributed under terms of the MIT license. | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Tests main conftest file.""" | |
import sys | |
import warnings | |
import pytest | |
sys.dont_write_bytecode = True | |
if not sys.version_info >= (3, 6): | |
warnings.simplefilter("error", category=DeprecationWarning) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Usage: | |
Make sure that redis is running on localhost (or adjust the url) | |
Install uvicorn or some other asgi server https://asgi.readthedocs.io/en/latest/implementations.html | |
pip install -u uvicorn | |
Install dependencies |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from abc import ABCMeta, abstractmethod | |
class SomeClass: | |
def __init__(self): | |
pass | |
def another_request(self): | |
print('test') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
TokenBucket implementation from http://code.activestate.com/recipes/511490-implementation-of-the-token-bucket-algorithm/ | |
""" | |
import asyncio | |
from time import time | |
from math import floor | |
import uvicorn | |
from fastapi import BackgroundTasks | |
from fastapi import FastAPI, BackgroundTasks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo dnf -y install dnf-automatic | |
sudo systemctl enable --now dnf-automatic-install.timer | |
sudo dnf -y upgrade --refresh | |
sudo dnf -y install dnf-plugin-system-upgrade | |
sudo dnf -y system-upgrade --allowerasing download --releasever=32 | |
sudo dnf -y system-upgrade reboot |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from __future__ import print_function | |
import sys | |
import logging | |
import traceback | |
logging.basicConfig(level=logging.DEBUG, | |
format='%(asctime)s %(module)-12s %(levelname)-8s %(message)s', | |
datefmt='%Y-%m-%d %H:%M:%S', | |
filename='/var/log/squid/calamari.log', | |
filemode='w') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# vim:fenc=utf-8 | |
# | |
# Copyright © 2018 Tim Hughes <[email protected]> | |
# | |
# Distributed under terms of the MIT license. | |
""" |