Toolset · BugSwarm REST API


Installation

Requires Python 3.

$ pip3 install bugswarm-common

Filtering and Retrieving Artifact Metadata

There are a few functions that are of interest in regards to filtering and retrieving metadata of artifacts.

  • find_artifact: Returns the metadata about an artifact.
  • list_artifacts: Returns a list of artifacts' metadata that are Java or Python and have at least one reproduce success.
  • filter_artifacts: Returns a list of artifacts' metadata based on a custom filter.

Usage

Requires a token

Import the DatabaseAPI and create a instance of it.

>>> from bugswarm.common.rest_api.database_api import DatabaseAPI
>>> bugswarmapi = DatabaseAPI(token=TOKEN)

Using the API to filter artifacts such that artifacts that are returned are: Java and are flaky.

>>> api_filter = '{"reproduce_successes":{"$gt":0, "$lt":5}, "lang":"Java"}'
>>> bugswarmapi.filter_artifacts(api_filter)

Using the API to retrieve metadata for one artifact.

>>> bugswarmapi.find_artifact('Abjad-abjad-289716771')

Using the API to retrieve metadata for all artifacts that are Java or Python and have at least one reproduce success.

>>> bugswarmapi.list_artifacts()

Source

The BugSwarm REST API is located: https://github.com/BugSwarm/common/blob/master/bugswarm/common/rest_api/database_api.py


Previous article

Next article