Quickstart

Let’s get started with some simple examples.

Use it on private Gerrit

If you want to use pGerrit on your private Gerrit host. Then you probably need to get a HTTP password for authentication.

If your Gerrit administrator stay default configuration, then you can find your HTTP password by Settings->``HTTPCredentials``->``GENERATE NEW PASSWORD``. And your username at Settings->``Profile``->``Username``

Then you can use it like below:

from pGerrit.client import GerritClient
from requests.auth import HTTPBasicAuth

auth = HTTPBasicAuth("xxxxxxxxxxxx","xxxxxxxxxxxxxx")
client = GerritClient("https://xxxx.gerrit.com/", auth=auth)
change = client.change("your_change_id")
current = change.current_revision()

detail = change.detail()

print("project name:" + detail.project)
print("branch name:" + detail.branch)
print("created time:" + detail.created)
print("updated time:" + detail.updated)

Ready for more? Check out the advanced section.