[python-bugzilla] How to get all bug IDs from bugzilla via python script

Ravikumar Patel ravikumarpatel2610 at gmail.com
Tue Jan 13 21:32:10 UTC 2015


I want to extract all information from a bug (comments, creator's name and
email, QA's name and email, etc) and save it to a text file but I'm not
able to. I can only access some of the data. I'm using Bugzilla version
4.2.5. Using *print dir(bz.getbug(8658))*, here is what I have access to
the following (see attachment).

So long story short, I cannot/don't have access to *description*, *dupe_of*
, *assigned_to*/*qa_contact *(can only get email but not the name),
*estimated_time*, *actual_time*, *remaining_time*, getting all *comments *(with
date, text, author, attachments reference) and *attachments *(file, date,
author, description).

But some of these attributes are available as tags on the bug's XML page.
So I thought maybe I could just parse the XML page and get all the info
from there. Do you have any suggestions? Otherwise I'm stuck because I
can't get all the info I need.

Thanks,
Ravi



On Tue, Jan 13, 2015 at 4:04 PM, Cole Robinson <crobinso at redhat.com> wrote:

> Sorry I didn't consider the auth issue.
>
> Modern bugzilla doesn't use cookies via the xmlrpc API, instead it uses a
> token which is API access only. So authenticating via python-bugzilla is
> not
> going to give you any way of accessing a regular bugzilla URL with auth. So
> there's no easy way that I can think of.
>
> What are you trying to achieve exactly? Why do you need the bug XML output?
> All that information should be available via the python-bugzilla API, so
> maybe
> you can achieve what you need in a different way
>
> - Cole
>
> On 01/13/2015 03:56 PM, Ravikumar Patel wrote:
> > Thanks for the help. Could you help me with that because I am having
> login
> > issues from a couple of stuff I found on the web? Or can you provide me
> with
> > any helpful links?
> >
> > So far I have looked at these and I keep getting a dummy html page (not
> > related to the bug) instead of the XML page for the bug:
> >
> >
> http://stackoverflow.com/questions/189555/how-to-use-python-to-login-to-a-webpage-and-retrieve-cookies-for-later-usage
> >
> http://stackoverflow.com/questions/11167419/get-xml-data-from-bugzilla-url
> >
> > On Tue, Jan 13, 2015 at 3:38 PM, Cole Robinson <crobinso at redhat.com
> > <mailto:crobinso at redhat.com>> wrote:
> >
> >     I guess you can just generate that URL from the bug's ID, then use
> standard
> >     python urllib or similar to fetch the web page contents. I don't
> think there's
> >     any bugzilla API call that does what you want though
> >
> >     - Cole
> >
> >     On 01/13/2015 03:35 PM, Ravikumar Patel wrote:
> >     > I'll guide you through the steps I've followed to clarify what I
> mean. First,
> >     > I queried for all bugs for a specific person. I then got a list of
> bugs for
> >     > that person with all of their bug IDs. I clicked on one of the bug
> ID and it
> >     > gave me a page with that bug's summary, status, aliases, product,
> etc. Once
> >     > you get to the bottom of the page, you have a link to it's XML
> view/page. (see
> >     > screenshot below)
> >     >
> >     > Inline image 1
> >     >
> >     > Now I want to get access to this page (using my python script from
> previous
> >     > emails):
> >     > Inline image 3
> >     >
> >     > I want to know if I can access this XML page from a corresponding
> bug ID via a
> >     > python script?
> >     >
> >     > Thanks,
> >     > Ravi
> >     >
> >     >
> >     > On Tue, Jan 13, 2015 at 2:25 PM, Cole Robinson <
> crobinso at redhat.com <mailto:crobinso at redhat.com>
> >     > <mailto:crobinso at redhat.com <mailto:crobinso at redhat.com>>> wrote:
> >     >
> >     >     I don't know what you mean by 'xml page'
> >     >
> >     >     - Cole
> >     >
> >     >     On 01/13/2015 02:23 PM, Ravikumar Patel wrote:
> >     >     > This is a follow up question. How do I now access each bug's
> XML page now that
> >     >     > I have the bug IDs I needed?
> >     >     >
> >     >     > On Tue, Jan 13, 2015 at 1:34 PM, Cole Robinson <
> crobinso at redhat.com <mailto:crobinso at redhat.com>
> >     <mailto:crobinso at redhat.com <mailto:crobinso at redhat.com>>
> >     >     > <mailto:crobinso at redhat.com <mailto:crobinso at redhat.com>
> >     <mailto:crobinso at redhat.com <mailto:crobinso at redhat.com>>>> wrote:
> >     >     >
> >     >     >     On 01/13/2015 12:59 PM, Ravikumar Patel wrote:
> >     >     >     > Hello,
> >     >     >     >
> >     >     >     > I am trying to get the bug ID of all bugs from my
> Bugzilla account. Any
> >     >     >     > suggestions as to how I am able to do so? Is it
> possible that to query for all
> >     >     >     > projects and then access the bug IDs from each
> project? If so, then how?
> >     >     >     >
> >     >     >     > So far my code looks like this:
> >     >     >     >
> >     >     >     > |bz = bugzilla.Bugzilla(url='
> https://bugzilla.mycompany.com/xmlrpc.cgi')
> >     >     >     > try:
> >     >     >     >    bz.login('name at email.com <mailto:name at email.com>
> <mailto:name at email.com
> >     <mailto:name at email.com>> <mailto:name at email.com <mailto:
> name at email.com>
> >     >     <mailto:name at email.com <mailto:name at email.com>>>
> >     >     >     <mailto:name at email.com <mailto:name at email.com> <mailto:
> name at email.com
> >     <mailto:name at email.com>>
> >     >     <mailto:name at email.com <mailto:name at email.com> <mailto:
> name at email.com
> >     <mailto:name at email.com>>>>', 'password');
> >     >     >     >    print'Authorization cookie received.'
> >     >     >     > except bugzilla.BugzillaError:
> >     >     >     >    print(str(sys.exc_info()[1]))
> >     >     >     >    sys.exit(1)|
> >     >     >     >
> >     >     >     > Here is the link to the stackoverflow question page:
> >     >     >     >
> http://stackoverflow.com/questions/27869663/how-do-i-query-bugzilla-to-get-all-the-bug-ids-using-python-and-xml-rpc
> >     >     >     >
> >     >     >     > I really need help on this. Any suggestions?
> >     >     >
> >     >     >     bugs =
> bz.query(bz.build_query(assigned_to="your-bugzilla-account"))
> >     >     >     for bug in bugs:
> >     >     >         print bug.id <http://bug.id> <http://bug.id> <
> http://bug.id>
> >     >     >
> >     >     >     - Cole
> >     >     >
> >     >     >
> >     >     >
> >     >     >
> >     >
> >     >
> >
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.fedorahosted.org/pipermail/python-bugzilla/attachments/20150113/acb02929/attachment-0001.html>
-------------- next part --------------
addcc
addcomment
addtag
appendwhiteboard
assigned_to
autorefresh
blocks
bugzilla
cc
cf_build_number
cf_device_os
cf_device_os_touchsense
cf_fixed_in_version
cf_hardware_parts
cf_root_cause
cf_version_string
classification
close
component
creation_time
creator
deletecc
deltag
depends_on
dupe_of (CAN'T ACCESS)
estimated_time
get_flag_status
get_flag_type
get_flags
get_history
gettags
getwhiteboard
groups
id
is_cc_accessible
is_confirmed
is_creator_accessible
is_open
keywords
last_change_time
op_sys
platform
prependwhiteboard
priority
product
qa_contact
refresh
reload
remaining_time
resolution
see_also
setassignee
setstatus
setwhiteboard
severity
status
summary
target_milestone
update_token
updateflags
url
version
weburl
whiteboard


More information about the python-bugzilla mailing list