phabricator
Phabricator module.
- wmflib.phabricator.create_phabricator(bot_config_file: str, *, section: str = 'phabricator_bot', dry_run: bool = True) Phabricator [source]
Initialize the Phabricator client from the bot config file.
Examples
from wmflib.phabricator import create_phabricator phab_client = create_phabricator("/path/to/config.ini", dry_run=False) phab_client.task_comment("T12345", "Message")
- Parameters:
bot_config_file (str) –
the path to the configuration file for the Phabricator bot, with the following structure:
[section_name] host = https://phabricator.example.com/api/ username = phab-bot token = api-12345
section (str, optional) – the name of the section of the configuration file where to find the required parameters.
dry_run (bool, optional) – whether this is a DRY-RUN.
- Returns:
a Phabricator instance.
- Return type:
- Raises:
wmflib.phabricator.PhabricatorError – if unable to get all the required parameters from the bot configuration file, or to initialize the Phabricator client.
- exception wmflib.phabricator.PhabricatorError[source]
Bases:
WmflibError
Custom exception class for errors of the Phabricator class.
- __doc__ = 'Custom exception class for errors of the Phabricator class.'
- __module__ = 'wmflib.phabricator'
- class wmflib.phabricator.Phabricator(phabricator_client: Phabricator, *, dry_run: bool = True)[source]
Bases:
object
Class to interact with a Phabricator website.
Initialize the Phabricator client from the bot config file.
- Parameters:
phabricator_client (phabricator.Phabricator) – a Phabricator client instance.
dry_run (bool, optional) – whether this is a DRY-RUN.
- __init__(phabricator_client: Phabricator, *, dry_run: bool = True) None [source]
Initialize the Phabricator client from the bot config file.
- Parameters:
phabricator_client (phabricator.Phabricator) – a Phabricator client instance.
dry_run (bool, optional) – whether this is a DRY-RUN.
- task_comment(task_id: str, comment: str) None [source]
Add a comment on a Phabricator task.
- Parameters:
- Raises:
wmflib.phabricator.PhabricatorError – if unable to update the task.
- __dict__ = mappingproxy({'__module__': 'wmflib.phabricator', '__doc__': 'Class to interact with a Phabricator website.', '__init__': <function Phabricator.__init__>, 'task_comment': <function Phabricator.task_comment>, '__dict__': <attribute '__dict__' of 'Phabricator' objects>, '__weakref__': <attribute '__weakref__' of 'Phabricator' objects>, '__annotations__': {}})
- __doc__ = 'Class to interact with a Phabricator website.'
- __module__ = 'wmflib.phabricator'
- __weakref__
list of weak references to the object (if defined)