Skip to main content

Client library for interacting with Gerrit's REST API

Project description

https://img.shields.io/pypi/v/pygerrit2.png https://img.shields.io/pypi/dm/pygerrit2.png https://img.shields.io/pypi/l/pygerrit2.png

Pygerrit2 provides a simple interface for clients to interact with Gerrit Code Review via the REST API.

Prerequisites

Pygerrit2 has been tested on Ubuntu 10.4 and Mac OSX 10.8.4, with Python 2.6.x and 2.7.x. Support for other platforms and Python versions is not guaranteed.

Pygerrit2 depends on the requests library.

Installation

To install pygerrit2, simply:

$ pip install pygerrit2

Configuration

For easier connection to the review server over the REST API, the user’s HTTP username and password can be given in the user’s .netrc file:

machine review login MyUsername password MyPassword

For instructions on how to obtain the HTTP password, refer to Gerrit’s HTTP upload settings documentation.

REST API

This simple example shows how to get the user’s open changes, authenticating to Gerrit via HTTP Digest authentication using an explicitly given username and password:

>>> from requests.auth import HTTPDigestAuth
>>> from pygerrit2.rest import GerritRestAPI
>>> auth = HTTPDigestAuth('username', 'password')
>>> rest = GerritRestAPI(url='http://review.example.net', auth=auth)
>>> changes = rest.get("/changes/?q=owner:self%20status:open")

Refer to the example script for a more detailed example of how the REST API interface works.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygerrit2-2.0.0.tar.gz (13.4 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page