|
|
|
@ -1,12 +1,10 @@ |
|
|
|
from django.conf import settings |
|
|
|
from celery import Celery |
|
|
|
from restscrape.utils import get_tab |
|
|
|
|
|
|
|
app = Celery("restscrape_funcs") |
|
|
|
app.conf.broker_url = "redis://localhost:6379/0" |
|
|
|
app.conf.result_backend = "redis://localhost:6379/0" |
|
|
|
|
|
|
|
|
|
|
|
@app.task |
|
|
|
def fetch_page(url, wait_for=0, proxy=None, use_adblock=True): |
|
|
|
with get_tab(proxy=proxy, use_adblock=use_adblock) as tab: |
|
|
|
return tab.open(url, wait_for=wait_for) |
|
|
|
app.conf.broker_url = getattr( |
|
|
|
settings, "MESSAGE_BROKER_URL", "amqp://myuser:mypassword@localhost:5672/myvhost" |
|
|
|
) |
|
|
|
app.conf.result_backend = getattr( |
|
|
|
settings, "RESULT_BACKEND_URL", "redis://localhost:6379/0" |
|
|
|
) |