gerrit.accounts package
Submodules
gerrit.accounts.account module
- class gerrit.accounts.account.GerritAccount(account, gerrit)[source]
Bases:
GerritBase
- check_capability(capability)[source]
Checks if a user has a certain global capability.
- Parameters:
capability –
- Returns:
- delete_active()[source]
Sets the account state to inactive. If the account was already inactive the response is ‘409 Conflict’.
- Returns:
- delete_draft_comments(input_)[source]
Deletes some or all of a user’s draft comments.
input_ = { "query": "is:abandoned" } account = client.accounts.get('kevin.shi') result = account.delete_draft_comments(input_)
- Parameters:
input – the DeleteDraftCommentsInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#delete-draft-comments-input
- Returns:
- delete_external_ids(input_)[source]
Delete a list of external ids for a user account. Only external ids belonging to the caller may be deleted. Users that have Modify Account can delete external ids that belong to other accounts.
input_ = [ "mailto:john.doe@example.com" ] account = client.accounts.get('kevin.shi') result = account.delete_external_ids(input_)
- Parameters:
input – the external ids as list
- Returns:
- delete_name()[source]
Deletes the name of an account. Some realms may not allow to delete the account name. In this case the request is rejected with ‘405 Method Not Allowed’.
- Returns:
- delete_watched_projects(input_)[source]
Projects posted to this endpoint will no longer be watched.
input_ = [ { "project": "Test Project 1", "filter": "branch:master" } ] account = client.accounts.get('kevin.shi') result = account.delete_watched_projects(input_)
- Parameters:
input – the watched projects as list
- Returns:
- property emails
- get_avatar()[source]
Retrieves the avatar image of the user, requires avatars-gravatar plugin.
- Returns:
- get_avatar_change_url()[source]
Retrieves the avatar image of the user, requires avatars-gravatar plugin.
- Returns:
- get_default_starred_changes()[source]
Gets the changes that were starred with the default star by the identified user account.
- Returns:
- get_external_ids()[source]
Retrieves the external ids of a user account. Only external ids belonging to the caller may be requested. Users that have Modify Account can request external ids that belong to other accounts.
- Returns:
- get_oauth_token()[source]
Returns a previously obtained OAuth access token. If there is no token available, or the token has already expired, ‘404 Not Found’ is returned as response. Requests to obtain an access token of another user are rejected with ‘403 Forbidden’.
- Returns:
- get_star_labels_from_change(id_)[source]
Get star labels from a change.
- Parameters:
id – change id
- Returns:
- get_starred_changes()[source]
Gets the changes that were starred with any label by the identified user account.
- Returns:
- get_status()[source]
Retrieves the status of an account. If the account does not have a status an empty string is returned.
- Getter:
Retrieves the status of an account.
- Setter:
Sets the status of an account
- Returns:
- property gpg_keys
- property groups
Lists all groups that contain the specified user as a member.
- Returns:
- list_capabilities()[source]
Returns the global capabilities that are enabled for the specified user.
- Returns:
- list_contributor_agreements()[source]
Gets a list of the user’s signed contributor agreements.
- Returns:
- modify_watched_projects(input_)[source]
Add new projects to watch or update existing watched projects. Projects that are already watched by a user will be updated with the provided configuration.
input_ = [ { "project": "Test Project 1", "notify_new_changes": true, "notify_new_patch_sets": true, "notify_all_comments": true, } ] account = client.accounts.get('kevin.shi') result = account.modify_watched_projects(input_)
- Parameters:
input – the ProjectWatchInfo entities as list
- Returns:
- put_default_star_on_change(id_)[source]
Star a change with the default label.
- Parameters:
id – change id
- Returns:
- remove_default_star_from_change(id_)[source]
Remove the default star label from a change. This stops notifications.
- Parameters:
id – change id
- Returns:
- set_diff_preferences(input_)[source]
Sets the diff preferences of a user.
input_ = { "context": 10, "theme": "ECLIPSE", "ignore_whitespace": "IGNORE_ALL", "intraline_difference": true, "line_length": 100, "cursor_blink_rate": 500, "show_line_endings": true, "show_tabs": true, "show_whitespace_errors": true, "syntax_highlighting": true, "tab_size": 8, "font_size": 12 } account = client.accounts.get('kevin.shi') result = account.set_diff_preferences(input_)
- Parameters:
input – the DiffPreferencesInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#diff-preferences-input
- Returns:
- set_displayname(input_)[source]
Sets the display name of an account. support this method since v3.2.0
input_ = { "display_name": "Kevin" } account = client.accounts.get('kevin.shi') result = account.set_displayname(input_)
- Parameters:
input – the DisplayNameInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#display-name-input
- Returns:
- set_edit_preferences(input_)[source]
Sets the edit preferences of a user.
input_ = { "theme": "ECLIPSE", "key_map_type": "VIM", "tab_size": 4, "line_length": 80, "indent_unit": 2, "cursor_blink_rate": 530, "hide_top_menu": true, "show_tabs": true, "show_whitespace_errors": true, "syntax_highlighting": true, "hide_line_numbers": true, "match_brackets": true, "line_wrapping": false, "auto_close_brackets": true } account = client.accounts.get('kevin.shi') result = account.set_edit_preferences(input_)
- Parameters:
input – the EditPreferencesInfo entity, https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#edit-preferences-info
- Returns:
- set_http_password(input_)[source]
Sets/Generates the HTTP password of an account.
input_ = { "generate": 'true', "http_password": "the_password" } account = client.accounts.get('kevin.shi') result = account.set_http_password(input_)
- Parameters:
input – the HttpPasswordInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#http-password-input
- Returns:
- set_name(input_)[source]
Sets the full name of an account. Some realms may not allow to modify the account name. In this case the request is rejected with ‘405 Method Not Allowed’.
input_ = { "name": "Keven Shi" } account = client.accounts.get('kevin.shi') result = account.set_name(input_)
- Parameters:
input – the AccountNameInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#account-name-input
- Returns:
- set_status(status)[source]
Sets the status of an account.
- Parameters:
status – account status
- Returns:
- set_user_preferences(input_)[source]
Sets the user’s preferences.
input_ = { "changes_per_page": 50, "show_site_header": true, "use_flash_clipboard": true, "expand_inline_diffs": true, "download_command": "CHECKOUT", "date_format": "STD", "time_format": "HHMM_12", "size_bar_in_change_table": true, "review_category_strategy": "NAME", "diff_view": "SIDE_BY_SIDE", "mute_common_path_prefixes": true, } account = client.accounts.get('kevin.shi') result = account.set_user_preferences(input_)
- Parameters:
input – the PreferencesInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#preferences-input
- Returns:
- set_username(input_)[source]
Sets the username of an account. Some realms may not allow to modify the account username. In this case the request is rejected with ‘405 Method Not Allowed’.
input_ = { "username": "shijl0925.shi" } account = client.accounts.get('kevin.shi') result = account.set_username(input_)
- Parameters:
input – the UsernameInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#username-input
- Returns:
- sign_contributor_agreement(input_)[source]
Signs a contributor agreement.
input_ = { "name": "Individual" } account = client.accounts.get('kevin.shi') result = account.sign_contributor_agreement(input_)
- Parameters:
input – the ContributorAgreementInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#contributor-agreement-input
- Returns:
- property ssh_keys
- update_star_labels_on_change(id_, input_)[source]
Update star labels on a change.
input_ = { "add": ["blue", "red"], "remove": ["yellow"] } account = client.accounts.get('kevin.shi') change_id = "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940" result = account.update_star_labels_on_change(change_id, input_)
- Parameters:
id – change id
input – the StarsInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#stars-input
- Returns:
gerrit.accounts.accounts module
- class gerrit.accounts.accounts.GerritAccounts(gerrit)[source]
Bases:
object
- create(username, input_)[source]
Creates a new account.
input_ = { "name": "John Doe", "email": "john.doe@example.com", "ssh_key": "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA0T...YImydZAw==", "http_password": "19D9aIn7zePb", "groups": [ "MyProject-Owners" ] } new_account = client.accounts.create('john.doe', input_)
- Parameters:
username – account username
input – the AccountInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#account-input
- Returns:
- get(account)[source]
Returns an account
- Parameters:
account – username or email or _account_id or ‘self’
- Returns:
- search(query: str, limit: int = 25, skip: int = 0, detailed: bool = False, suggested: bool = False, all_emails: bool = False)[source]
Queries accounts visible to the caller.
- Parameters:
query – Query string
limit – Int value that allows to limit the number of accounts to be included in the output results
skip – Int value that allows to skip the given number of accounts from the beginning of the list
detailed – boolean value, if True then full name, preferred email, username and avatars for each account will be added to the output result
suggested – boolean value, if True get account suggestions based on query string. If a result limit n is not specified, then the default 10 is used.
all_emails – boolean value, if True then all registered emails for each account will be added to the output result
- Returns:
gerrit.accounts.emails module
- class gerrit.accounts.emails.GerritAccountEmail(email, account, gerrit)[source]
Bases:
GerritBase
gerrit.accounts.gpg_keys module
- class gerrit.accounts.gpg_keys.GerritAccountGPGKey(id, account, gerrit)[source]
Bases:
GerritBase
- class gerrit.accounts.gpg_keys.GerritAccountGPGKeys(account, gerrit)[source]
Bases:
object
- modify(input_)[source]
Add or delete one or more GPG keys for a user.
input_ = { "add": [ "-----BEGIN PGP PUBLIC KEY BLOCK-----\n Version: GnuPG v1\n\n mQENBFXUpNcBCACv4paCiyKxZ0EcKy8VaWVNkJlNebRBiyw9WxU85wPOq5Gz/3GT\n RQwKqeY0SxVdQT8VNBw2sBe2m6eqcfZ2iKmesSlbXMe15DA7k8Bg4zEpQ0tXNG1L\n hceZDVQ1Xk06T2sgkunaiPsXi82nwN3UWYtDXxX4is5e6xBNL48Jgz4lbqo6+8D5\n vsVYiYMx4AwRkJyt/oA3IZAtSlY8Yd445nY14VPcnsGRwGWTLyZv9gxKHRUppVhQ\n E3o6ePXKEVgmONnQ4CjqmkGwWZvjMF2EPtAxvQLAuFa8Hqtkq5cgfgVkv/Vrcln4\n nQZVoMm3a3f5ODii2tQzNh6+7LL1bpqAmVEtABEBAAG0H0pvaG4gRG9lIDxqb2hu\n LmRvZUBleGFtcGxlLmNvbT6JATgEEwECACIFAlXUpNcCGwMGCwkIBwMCBhUIAgkK\n CwQWAgMBAh4BAheAAAoJEJNQnkuvyKSbfjoH/2OcSQOu1kJ20ndjhgY2yNChm7gd\n tU7TEBbB0TsLeazkrrLtKvrpW5+CRe07ZAG9HOtp3DikwAyrhSxhlYgVsQDhgB8q\n G0tYiZtQ88YyYrncCQ4hwknrcWXVW9bK3V4ZauxzPv3ADSloyR9tMURw5iHCIeL5\n fIw/pLvA3RjPMx4Sfow/bqRCUELua39prGw5Tv8a2ZRFbj2sgP5j8lUFegyJPQ4z\n tJhe6zZvKOzvIyxHO8llLmdrImsXRL9eqroWGs0VYqe6baQpY6xpSjbYK0J5HYcg\n TO+/u80JI+ROTMHE6unGp5Pgh/xIz6Wd34E0lWL1eOyNfGiPLyRWn1d0yZO5AQ0E\n VdSk1wEIALUycrH2HK9zQYdR/KJo1yJJuaextLWsYYn881yDQo/p06U5vXOZ28lG\n Aq/Xs96woVZPbgME6FyQzhf20Z2sbr+5bNo3OcEKaKX3Eo/sWwSJ7bXbGLDxMf4S\n etfY1WDC+4rTqE30JuC++nQviPRdCcZf0AEgM6TxVhYEMVYwV787YO1IH62EBICM\n SkIONOfnusNZ4Skgjq9OzakOOpROZ4tki5cH/5oSDgdcaGPy1CFDpL9fG6er2zzk\n sw3qCbraqZrrlgpinWcAduiao67U/dV18O6OjYzrt33fTKZ0+bXhk1h1gloC21MQ\n ya0CXlnfR/FOQhvuK0RlbR3cMfhZQscAEQEAAYkBHwQYAQIACQUCVdSk1wIbDAAK\n CRCTUJ5Lr8ikm8+QB/4uE+AlvFQFh9W8koPdfk7CJF7wdgZZ2NDtktvLL71WuMK8\n POmf9f5JtcLCX4iJxGzcWogAR5ed20NgUoHUg7jn9Xm3fvP+kiqL6WqPhjazd89h\n k06v9hPE65kp4wb0fQqDrtWfP1lFGuh77rQgISt3Y4QutDl49vXS183JAfGPxFxx\n 8FgGcfNwL2LVObvqCA0WLqeIrQVbniBPFGocE3yA/0W9BB/xtolpKfgMMsqGRMeu\n 9oIsNxB2oE61OsqjUtGsnKQi8k5CZbhJaql4S89vwS+efK0R+mo+0N55b0XxRlCS\n faURgAcjarQzJnG0hUps2GNO/+nM7UyyJAGfHlh5\n =EdXO\n -----END PGP PUBLIC KEY BLOCK-----\n" ], "delete": [ "DEADBEEF", ] } account = client.accounts.get('kevin.shi') result = account.gpg_keys.modify(input_)
- Parameters:
input – the GpgKeysInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#gpg-keys-input
- Returns:
gerrit.accounts.ssh_keys module
- class gerrit.accounts.ssh_keys.GerritAccountSSHKey(seq, account, gerrit)[source]
Bases:
GerritBase