Commit 06c11d4772fa9cb27a5ba06476c9daf72daa2f39
1 parent
5f51339e
Exists in
master
and in
39 other branches
Add interface for data importation for proxies
-Proxies utilizes the data_api.py fetchData() to expecify how to import their data into the colab database -Gitlab need to add the variable auth_token to colab.yml to have the permission of acces to the gitlabAPI data Signed-off-by: Gustavo Jaruga <darksshades@gmail.com> Signed-off-by: Charles Oliveira <18oliveira.charles@gmail.com> Signed-off-by: Carlos Oliveira <carlospecter@gmail.com>
Showing
7 changed files
with
32 additions
and
2 deletions
Show diff stats
colab/proxy/gitlab/data_api.py
colab/proxy/gitlab/models.py
colab/proxy/proxybase/management/commands/import_proxy_data.py
0 → 100644
... | ... | @@ -0,0 +1,21 @@ |
1 | +#!/usr/bin/env python | |
2 | + | |
3 | +import colab | |
4 | +from django.core.management.base import BaseCommand | |
5 | +from colab.super_archives.models import Message | |
6 | +from django.conf import settings | |
7 | +modules = [ i for i in settings.INSTALLED_APPS if i.startswith("colab.proxy.") ] | |
8 | +for module in modules: | |
9 | + module += ".data_api" | |
10 | + __import__(module, locals(), globals()) | |
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 in modules: | |
19 | + extractionClassname = module + ".data_api." + module.split('.')[-1].title() + "DataAPI" | |
20 | + api = eval(extractionClassname)() | |
21 | + api.fetchData() | ... | ... |
colab/settings.py
... | ... | @@ -321,8 +321,9 @@ if FEEDZILLA_ENABLED: |
321 | 321 | 'common', |
322 | 322 | ) |
323 | 323 | |
324 | -PROXIED_APPS = locals().get('PROXIED_APPS') or {} | |
325 | 324 | BROWSERID_ENABLED = locals().get('BROWSERID_ENABLED') or False |
326 | 325 | |
326 | +PROXIED_APPS = locals().get('PROXIED_APPS') or {} | |
327 | + | |
327 | 328 | for app_label in PROXIED_APPS.keys(): |
328 | 329 | INSTALLED_APPS += ('colab.proxy.{}'.format(app_label),) | ... | ... |