Commit a12566bc056fd7fceb3bed22b9b78c8e9f24eb17

Authored by Sergio Oliveira
1 parent 7ba7f4e6

Data import moved to celery

Signed-off-by: Sergio Oliveira <sergio@tracy.com.br>
colab/plugins/management/__init__.py
colab/plugins/management/commands/__init__.py
colab/plugins/management/commands/import_proxy_data.py
@@ -1,31 +0,0 @@ @@ -1,31 +0,0 @@
1 -#!/usr/bin/env python  
2 -  
3 -import importlib  
4 -import inspect  
5 -  
6 -from django.core.management.base import BaseCommand  
7 -from django.conf import settings  
8 -  
9 -from colab.plugins.utils.proxy_data_api import ProxyDataAPI  
10 -  
11 -  
12 -class Command(BaseCommand):  
13 - help = "Import proxy data into colab database"  
14 -  
15 - def handle(self, *args, **kwargs):  
16 - print "Executing extraction command..."  
17 -  
18 - for module_name in settings.PROXIED_APPS.keys():  
19 - module_path = \  
20 - 'colab.plugins.{}.data_api'.format(module_name.split('.')[-1])  
21 - module = importlib.import_module(module_path)  
22 -  
23 - for module_item_name in dir(module):  
24 - module_item = getattr(module, module_item_name)  
25 - if not inspect.isclass(module_item):  
26 - continue  
27 - if issubclass(module_item, ProxyDataAPI):  
28 - if module_item != ProxyDataAPI:  
29 - api = module_item()  
30 - api.fetch_data()  
31 - break