-
Notifications
You must be signed in to change notification settings - Fork 0
/
runner.py
41 lines (40 loc) · 1.05 KB
/
runner.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from scrapy.cmdline import execute
import subprocess
import os
import shlex
try:
# sourcing the environment variables from the 'outside_docker.sh' file
command = shlex.split("env -i bash -c 'source outside_docker.sh && env'")
proc = subprocess.run(command, capture_output=True, text=True)
for line in proc.stdout.split('\n'):
if line == '':
break
key, value = line.split('=')
os.environ[key] = value
# actual scrapy command
execute(
[
'scrapy',
'crawl',
# 'search_results',
# 'details',
'data_monitor',
# '-O',
# 'test.json',
# '--loglevel=DEBUG',
# '-s',
# 'HTTPCACHE_ENABLED=False',
# '-s',
# 'HTTPCACHE_FORCE_REFRESH=True',
'-s',
'NO_DB=True',
# '-a',
# 'context=person',
# '-a',
# 'items=1'
# '-a',
# 'ids=[215969423]'
]
)
except SystemExit:
pass