BugList
|
Size: 5149
Comment:
|
Size: 4874
Comment:
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 49: | Line 49: |
| BugList objects are set-like objects, each member is an instance of LPBugInfo. | `BugList` objects are set-like objects, each member is an instance of `LPBugInfo`. {{{#!python >>> bl <BugList https://bugs.launchpad.net/ubuntu/+source/bughelper/+bugs> >>> print bl BugList([<BugInfo 129341>,<BugInfo 88102>,<BugInfo 150887>]) >>> len(bl) 3 }}} |
| Line 53: | Line 62: |
| A LPBugInfo object has this attribute: | A `LPBugInfo` object has this attribute: |
| Line 61: | Line 70: |
| || .sourcepackage || returns affected package within a distribution or an empty string || || | || .sourcepackage || returns affected package within a distribution or an empty string|| || |
| Line 63: | Line 72: |
| === Getting a list of bugs and print available information: === | |
| Line 65: | Line 73: |
| l = BugList("https://bugs.launchpad.net/ubuntu/+source/bughelper/+bugs") for i in l.bugs: print i.bugnumber, print i.url, print i.summary, print i.importance, print i.status, print i.sourcepackage |
>>> b = bl.pop() >>> b <BugInfo 239007> >>> print b [Bug 239007 : Confirmed/Undecided] >>> int(b) 239007 |
| Line 74: | Line 81: |
| {{{ 88521 https://bugs.launchpad.net/ubuntu/+source/bughelper/+bug/88521 selectively pulling attachments by name Medium Incomplete None | |
| Line 76: | Line 82: |
| 88102 https://bugs.launchpad.net/ubuntu/+source/bughelper/+bug/88102 sort report by issue type rather than bug number Undecided Confirmed None }}} |
ContentsBRTableOfContents |
BugList - tutorial
This is still work in progress
General workflow
This is how to use python-launchpad-bugs to get a list of bugs
If you need a faster method to fetch the bug list but can abdicate additional information like status and importance of a bugreport it is possible to use the text mode of launchpad:
2 >>> BugList = ConnectBugList("text") # using the text mode
In some cases, e.g. if the resulting lists should contain private bugreports, authentication is necessary
It is also possible to do authentication via email-login and password. Note: This takes much longer than using cookie files, therefore python-launchpad-bugs provides a method to save the resulting cookie into a file
7 >>> BugList.authentication={"email": "[email protected]", "passwort": "YourPassword"}
8 >>> BugList.connection.save_cookie("/home/markus/.lpcookie")
There are currently different versions of launchpad, the stable bugs.launchpad.net and the testing environment bugs.edge.launchpad.net. Sometimes it makes sense to explicitly choose one of these versions to work with. In python-launchpad-bugs it is possible to define which version to use.
Bug list objects
BugList objects are set-like objects, each member is an instance of LPBugInfo.
LPBugInfo
A LPBugInfo object has this attribute:
Attribute |
Description |
Example |
.bugnumber |
number of a bugreport (type of int) |
|
.url |
url to this bugreport (task specific) |
|
.summary |
one-line title of a bugreport |
|
.importance |
importance of a bugreport |
|
.status |
status of a bugreport |
|
.sourcepackage |
returns affected package within a distribution or an empty string |
|
Adding some (upstream) bugs to the set
{{{ set([109628, 110937, 88521, 88102, 84723, 88102, 81291, 85152, 88521, 90084, 109547]) }}}
Setting a filter and filter the set of bugs
{{{ set([110937, 109547]) }}}
Sorting the list of bugs
1 print l.sort("nr")
{{{ [109547, 110937] }}}
add LP urloptions to an url
{{{ set([123180, 122818, 123394, 119270, 123440, 87364, 105224, 108482, 95504, 114215, 118407, 118827, 119104, 95822, 121121, 121341, 122196, 123216, 122274, 122347, 122522, 122798, 89916, 122882, 94130, 122859, 123062]) }}}
Raising `LPUrlError` for invalid urls
"'Page not found (url: https://bugs.launchpad.net/ubuntu/+source/firefokkksss/+bugs)'"
Use custom-made filter-functions
{{{ RFE: Web interface to bughelper (81291) RFE: grep for package version (84723) }}}
Go Back to [:BugHelper/Dev].BR CategoryBugHelper
BugHelper/Dev/python-launchpad-bugs/BugList (last edited 2008-08-06 17:01:38 by localhost)