From 7b630e692a4b2062fece05093682c8758d60fed6 Mon Sep 17 00:00:00 2001 From: Slater-Victoroff Date: Wed, 12 Mar 2014 02:26:47 -0400 Subject: [PATCH] Class attachments working --- IndicoIo/__init__.py | 17 +++++++++++++++++ IndicoIo/conf.py | 1 + IndicoIo/examples/__init__.py | 0 3 files changed, 18 insertions(+) create mode 100644 IndicoIo/conf.py create mode 100644 IndicoIo/examples/__init__.py diff --git a/IndicoIo/__init__.py b/IndicoIo/__init__.py index e69de29..c73fc5b 100644 --- a/IndicoIo/__init__.py +++ b/IndicoIo/__init__.py @@ -0,0 +1,17 @@ +import os, pkgutil, imp + +from config import active_modules + +API_KEY = os.environ["INDICO_API_KEY"] or None + +API_KEY = open("$HOME/.indico").read() or None + +class Indico(object): + + def __init__(api_key = API_KEY): + self.API_KEY = API_KEY + + for module in active_modules: + actual_module = imp.new_module(module) + for _, name, _ in pkgutil.iter_modules([module]): + setattr(self, name, getattr(actual_module, name)) diff --git a/IndicoIo/conf.py b/IndicoIo/conf.py new file mode 100644 index 0000000..da9f382 --- /dev/null +++ b/IndicoIo/conf.py @@ -0,0 +1 @@ +active_modules = ["text", "images"] diff --git a/IndicoIo/examples/__init__.py b/IndicoIo/examples/__init__.py new file mode 100644 index 0000000..e69de29