Standardize communicating with the Review Board API.
Review Request #11535 — Created March 19, 2021 and submitted — Latest diff uploaded
We had a few spots where we constructed a
RBClient
and fetching the
API root, each time passing in a string for the user agent and for the
cookie path, with TODO comments saying we should consolidate this
information.This change does just that. It introduces
rbtools.utils.api
, which
providesget_api_root()
. This takes in a server URL and credentials,
and returns the root resource.That handles
RBClient
construction, passing in a user agent (now set
toReviewBot/<version>
, rather than justReviewBot
) and a cookies
file.The cookies file still needs to be made configurable, but that will be
handled separately.Unit tests have not been added for this new function, since it's pretty
well covered by existing tests (both in Review Bot and RBTools), and
there's not much happening beyond passing in arguments and called
pre-tested methods.
Unit tests pass on Python 2.7 and 3.x.