summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid McMackins II <contact@mcmackins.org>2015-08-21 20:42:11 -0500
committerDavid McMackins II <contact@mcmackins.org>2015-08-21 20:42:11 -0500
commita5d77aea7efc8a012414b8d7a464fbaf79a346da (patch)
tree08f18b471abb846b06560e5ae193f1b723cb072e
parent6e975d699fcff4189f585731226bfd05bc30bf4f (diff)
Now able to load single plugin files
-rw-r--r--coinfetch.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/coinfetch.py b/coinfetch.py
index 22df1e4..af36d92 100644
--- a/coinfetch.py
+++ b/coinfetch.py
@@ -15,6 +15,8 @@
## along with this program. If not, see <http://www.gnu.org/licenses/>.
##
+from os import listdir
+from os.path import isdir
from requests import get
__version__ = '5.0.0'
@@ -84,6 +86,16 @@ def get_registered_tickers():
def get_ticker(key):
return _tickers[key][_INDEX['value']]
+## Loads a plugin or directory of plugins.
+# @param path Path to the plugin file or a directory containing plugins.
+def load(path):
+ if isdir(path):
+ for f in listdir:
+ load(join(path, f))
+ else:
+ with open(path) as plugin:
+ exec(plugin.read(), globals(), locals())
+
## Registers a new ticker API.
# @param name Name of this ticker.
# @param description A brief description of this ticker.