cliche.services
— Interfacing external services¶
How to add a new external service¶
In order to add a new service to cliche, you must create a subpackage under
cliche.services
and expose some methods referring to interfaces,
using __init__.py
.
Interfaces needed to be exposed¶
sync()
: Method to delay a main crawling task to the queue. It should be decorated with@app.task
to be defined as a celery app worker task. It should have no arguments and no return. Every output should be made as a log to celery logger.
Example __init__.py
¶
from .crawler import crawl as sync # noqa
__all__ = 'sync',
Note that you will need the import lines annotated with # noqa
because
otherwise flake8 will consider it as unused import.