Skip to content

Instantly share code, notes, and snippets.

View nicholasamorim's full-sized avatar

Nicholas Amorim nicholasamorim

  • Amsterdam, Netherlands
View GitHub Profile
@nicholasamorim
nicholasamorim / dynamic_import.py
Created January 28, 2016 09:47
Importing all SqlAlchemy models classes dynamically - look in a module for all subclasses of specific class and import it into localnamespace
import inspect
import pkgutil
def import_all_subclasses_of(module_to_scan, baseclass, scope):
"""
:param module_to_scan: Module to scan.
:param baseclass: A base class to check.
:param scope: globals(), locals() or a dict-like object.
"""
@nicholasamorim
nicholasamorim / gist:382fc6957a6a2157e985daaf441764a3
Created May 1, 2019 07:06
Minimal example on tracing requests library
import requests
from jaeger_client import Config
from opentracing_instrumentation.client_hooks import install_all_patches
def init_tracer():
install_all_patches()
config = Config(
config={ # usually read from some yaml config