Bugsy
¶
-
class
bugsy.
Bugsy
(username=None, password=None, userid=None, cookie=None, api_key=None, bugzilla_url='https://bugzilla.mozilla.org/rest')[source]¶ Bugsy allows easy getting and putting of Bugzilla bugs
-
__init__
(username=None, password=None, userid=None, cookie=None, api_key=None, bugzilla_url='https://bugzilla.mozilla.org/rest')[source]¶ Initialises a new instance of Bugsy
Parameters: - username – Username to login with. Defaults to None
- password – Password to login with. Defaults to None
- userid – User ID to login with. Defaults to None
- cookie – Cookie to login with. Defaults to None
- apikey – API key to use. Defaults to None.
- bugzilla_url – URL endpoint to interact with. Defaults to
https://bugzilla.mozilla.org/rest
If a api_key is passed in, Bugsy will use this for authenticating requests. While not required to perform requests, if a username is passed in along with api_key, we will validate that the api key is valid for this username. Otherwise the api key is blindly used later.
If a username AND password are passed in Bugsy will try get a login token from Bugzilla. If we can’t login then a LoginException will be raised.
If a userid AND cookie are passed in Bugsy will create a login token from them. If no username was passed in it will then try to get the username from Bugzilla.
-
__weakref__
¶ list of weak references to the object (if defined)
-
authenticated
¶ True if this instance is authenticated against the server.
>>> bugzilla = Bugsy() >>> assert not bugzilla.authenticated
-
get
(bug_number)[source]¶ Get a bug from Bugzilla. If there is a login token created during object initialisation it will be part of the query string passed to Bugzilla
Parameters: bug_number – Bug Number that will be searched. If found will return a Bug object. >>> bugzilla = Bugsy() >>> bug = bugzilla.get(123456)
-
put
(bug)[source]¶ This method allows you to create or update a bug on Bugzilla. You will have had to pass in a valid username and password to the object initialisation and recieved back a token.
Parameters: bug – A Bug object either created by hand or by using get() If there is no valid token then a BugsyException will be raised. If the object passed in is not a Bug then a BugsyException will be raised.
>>> bugzilla = Bugsy() >>> bug = bugzilla.get(123456) >>> bug.summary = "I like cheese and sausages" >>> bugzilla.put(bug)
-