phabricator/tasks: Allow to pass api_token as optional parameter

This is useful when one wants to test the lister in docker environment.
This commit is contained in:
Antoine Lambert 2021-01-11 16:22:17 +01:00
parent 9944295729
commit b48f71ff93

View file

@ -1,16 +1,20 @@
# Copyright (C) 2019 the Software Heritage developers
# Copyright (C) 2019-2021 the Software Heritage developers
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
from typing import Optional
from celery import shared_task
from swh.lister.phabricator.lister import PhabricatorLister
@shared_task(name=__name__ + ".FullPhabricatorLister")
def list_phabricator_full(url: str, instance: str):
def list_phabricator_full(url: str, instance: str, api_token: Optional[str] = None):
"""Full update of a Phabricator instance"""
return PhabricatorLister.from_configfile(url=url, instance=instance).run()
return PhabricatorLister.from_configfile(
url=url, instance=instance, api_token=api_token
).run()
@shared_task(name=__name__ + ".ping")