-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtasks.py
More file actions
26 lines (24 loc) · 781 Bytes
/
tasks.py
File metadata and controls
26 lines (24 loc) · 781 Bytes
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
import time
from worker import celery
from config import config
import twint
from arguments import TwintArguments
@celery.task(name='fetch')
def fetch(args):
# Merge user arguments with default Twint config
config = TwintArguments()
config.__dict__.update(args)
print("Start fetch task %s %s -> %s" %
(config.id, config.Since, config.Until))
# Run
twint.run.Search(config)
# Finished
return "Fetch task finished %s %s -> %s" % \
(config.id, config.Since, config.Until)
# # Save/report progress if you want or example to firebase
# @celery.task(name='save')
# def save(args):
# db = firebase.database()
# # Make process entry on firebase
# db.child("Processes").child(args['id']).set(args)
# return "Progress saved"