Skip to content

Commit dcda30f

Browse files
committed
collectors_dir settings
1 parent f4ab188 commit dcda30f

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ migrations
99
alembic.ini
1010
alembic
1111
env/
12-
local_checkers/
12+
local/

collectors_list.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1+
from models import session, CollectorState
2+
from proxy_py import settings
3+
14
import os
25
import importlib.util
36

4-
from models import session, CollectorState
5-
67

78
collectors = {}
89

910

10-
for root, dirs, files in os.walk("collectors"):
11+
for root, dirs, files in os.walk(settings.COLLECTORS_DIR):
1112
for file in files:
1213
if file.endswith(".py"):
1314
file_path = os.path.join(root, file)
@@ -43,18 +44,18 @@
4344
# return collectorState
4445

4546

46-
def get_collector_of_module_name(module_name : str):
47+
def get_collector_of_module_name(module_name: str):
4748
if module_name not in collectors:
4849
raise CollectorNotFoundException()
4950

5051
return collectors[module_name]
5152

5253

53-
async def load_collector(state : CollectorState):
54+
async def load_collector(state: CollectorState):
5455
collector = get_collector_of_module_name(state.identifier)
5556
await collector.load_state(state)
5657
return collector
5758

5859

5960
class CollectorNotFoundException(BaseException):
60-
pass
61+
pass

proxy_py/_settings.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
DEBUG = True
1515

16+
COLLECTORS_DIR = 'collectors'
17+
1618
# fetcher settings
1719

1820
CONCURRENT_TASKS_COUNT = 128

0 commit comments

Comments
 (0)