Skip to content

Instantly share code, notes, and snippets.

View wojss's full-sized avatar
✈️
起飞

wojss wojss

✈️
起飞
View GitHub Profile
@stefansundin
stefansundin / requests_api.py
Last active November 8, 2024 06:59
Reusable class for Python requests library.
# http://docs.python-requests.org/en/master/api/
import requests
class RequestsApi:
def __init__(self, base_url, **kwargs):
self.base_url = base_url
self.session = requests.Session()
for arg in kwargs:
if isinstance(kwargs[arg], dict):
kwargs[arg] = self.__deep_merge(getattr(self.session, arg), kwargs[arg])
@nkhitrov
nkhitrov / logger.py
Last active October 15, 2024 04:13
Configure uvicorn logs with loguru for FastAPI
"""
WARNING: dont use loguru, use structlog
https://gist.github.com/nkhitrov/38adbb314f0d35371eba4ffb8f27078f
Configure handlers and formats for application loggers.
"""
import logging
import sys
from pprint import pformat