# bugzilla

This command allows you to download attachments from a bugzilla server that supports REST API.

    usage: orcus.tools.bugzilla [-h] --outdir OUTDIR [--limit LIMIT]
                                [--offset OFFSET] [--cont] [--worker WORKER]
                                [--cache-dir CACHE_DIR] --url URL
                                [query ...]

## Positional Arguments

`query`

  One or more query term to use to limit your search. Each query term must be in the form key=value. You need to quote the value string when the value string contains whitespace character i.e. key=”value with space”.

## Named Arguments

`--outdir, -o`

  output directory for downloaded files. Downloaded files are grouped by their respective bug ID’s.

`--limit`

  number of bugs to include in a single set of search results.

  Default: `50`

`--offset`

  number of bugs to skip in the search results.

  Default: `0`

`--cont`

  when specified, the search continues after the initial batch is returned, by retrieving the next batch of results until the entire search results are returned. The number specified by the `--limit` option is used as the batch size.

  Default: `False`

`--worker`

  number of worker threads to use for parallel downloads of files.

  Default: `8`

`--cache-dir`

  directory to keep downloaded bugzilla search results. The command will not send the query request to the remote server when the results are cached. You may want to delete the cache directory after you are finished.

  Default: `.bugzilla`

`--url`

  base URL for bugzilla service. It must begin with the `http(s)://` prefix.

class orcus.tools.bugzilla.BugzillaAccess(bzurl, cache_dir)

  Encapsulates access to a bugzilla server by using its REST API.

  Parameters:

    - bzurl (str) – URL to the bugzilla server.

    - cache_dir (`pathlib.Path`) – path to the cache directory.

  get_bug_ids(bz_params)

    Get all bug ID’s for specified bugzilla query parameters.

    Parameters:

      bz_params (dict) – dictionary containing all search parameters. Each search term must form a single key-value pair.

    Returns (`list` of `str`):

      list of bug ID strings.

  get_attachments(bug_id)

    Fetch all attachments for specified bug.