INSTRUCTION stringlengths 1 46.3k | RESPONSE stringlengths 75 80.2k |
|---|---|
Create a new issue and return an issue Resource for it.
Each keyword argument (other than the predefined ones) is treated as a field name and the argument's value
is treated as the intended value for that field -- if the fields argument is used, all other keyword arguments
will be ignored.
... | def create_issue(self, fields=None, prefetch=True, **fieldargs):
"""Create a new issue and return an issue Resource for it.
Each keyword argument (other than the predefined ones) is treated as a field name and the argument's value
is treated as the intended value for that field -- if the fields... |
Bulk create new issues and return an issue Resource for each successfully created issue.
See `create_issue` documentation for field information.
:param field_list: a list of dicts each containing field names and the values to use. Each dict
is an individual issue to create and is subject t... | def create_issues(self, field_list, prefetch=True):
"""Bulk create new issues and return an issue Resource for each successfully created issue.
See `create_issue` documentation for field information.
:param field_list: a list of dicts each containing field names and the values to use. Each dic... |
Returns whether or not the JIRA instance supports service desk.
:rtype: bool | def supports_service_desk(self):
"""Returns whether or not the JIRA instance supports service desk.
:rtype: bool
"""
url = self._options['server'] + '/rest/servicedeskapi/info'
headers = {'X-ExperimentalApi': 'opt-in'}
try:
r = self._session.get(url, headers=... |
Create a new customer and return an issue Resource for it.
:param email: Customer Email
:type email: str
:param displayName: Customer display name
:type displayName: str
:rtype: Customer | def create_customer(self, email, displayName):
"""Create a new customer and return an issue Resource for it.
:param email: Customer Email
:type email: str
:param displayName: Customer display name
:type displayName: str
:rtype: Customer
"""
url = self._o... |
Get a list of ServiceDesk Resources from the server visible to the current authenticated user.
:rtype: List[ServiceDesk] | def service_desks(self):
"""Get a list of ServiceDesk Resources from the server visible to the current authenticated user.
:rtype: List[ServiceDesk]
"""
url = self._options['server'] + '/rest/servicedeskapi/servicedesk'
headers = {'X-ExperimentalApi': 'opt-in'}
r_json =... |
Create a new customer request and return an issue Resource for it.
Each keyword argument (other than the predefined ones) is treated as a field name and the argument's value
is treated as the intended value for that field -- if the fields argument is used, all other keyword arguments
will be ig... | def create_customer_request(self, fields=None, prefetch=True, **fieldargs):
"""Create a new customer request and return an issue Resource for it.
Each keyword argument (other than the predefined ones) is treated as a field name and the argument's value
is treated as the intended value for that ... |
Get the metadata required to create issues, optionally filtered by projects and issue types.
:param projectKeys: keys of the projects to filter the results with.
Can be a single value or a comma-delimited string. May be combined
with projectIds.
:type projectKeys: Union[None, Tu... | def createmeta(self,
projectKeys=None,
projectIds=[],
issuetypeIds=None,
issuetypeNames=None,
expand=None,
):
"""Get the metadata required to create issues, optionally filtered by projects and issue... |
Assign an issue to a user. None will set it to unassigned. -1 will set it to Automatic.
:param issue: the issue ID or key to assign
:type issue: int or str
:param assignee: the user to assign the issue to
:type assignee: str
:rtype: bool | def assign_issue(self, issue, assignee):
"""Assign an issue to a user. None will set it to unassigned. -1 will set it to Automatic.
:param issue: the issue ID or key to assign
:type issue: int or str
:param assignee: the user to assign the issue to
:type assignee: str
:... |
Get a list of comment Resources.
:param issue: the issue to get comments from
:type issue: str
:rtype: List[Comment] | def comments(self, issue):
"""Get a list of comment Resources.
:param issue: the issue to get comments from
:type issue: str
:rtype: List[Comment]
"""
r_json = self._get_json('issue/' + str(issue) + '/comment')
comments = [Comment(self._options, self._session, r... |
Add a comment from the current authenticated user on the specified issue and return a Resource for it.
The issue identifier and comment body are required.
:param issue: ID or key of the issue to add the comment to
:type issue: str
:param body: Text of the comment to add
:type b... | def add_comment(self, issue, body, visibility=None, is_internal=False):
"""Add a comment from the current authenticated user on the specified issue and return a Resource for it.
The issue identifier and comment body are required.
:param issue: ID or key of the issue to add the comment to
... |
Get a list of remote link Resources from an issue.
:param issue: the issue to get remote links from | def remote_links(self, issue):
"""Get a list of remote link Resources from an issue.
:param issue: the issue to get remote links from
"""
r_json = self._get_json('issue/' + str(issue) + '/remotelink')
remote_links = [RemoteLink(
self._options, self._session, raw_remo... |
Add a remote link from an issue to an external application and returns a remote link Resource for it.
``object`` should be a dict containing at least ``url`` to the linked external URL and
``title`` to display for the link inside JIRA.
For definitions of the allowable fields for ``object`` and... | def add_remote_link(self, issue, destination, globalId=None, application=None, relationship=None):
"""Add a remote link from an issue to an external application and returns a remote link Resource for it.
``object`` should be a dict containing at least ``url`` to the linked external URL and
``ti... |
Add a simple remote link from an issue to web resource.
This avoids the admin access problems from add_remote_link by just
using a simple object and presuming all fields are correct and not
requiring more complex ``application`` data.
``object`` should be a dict containing at l... | def add_simple_link(self, issue, object):
"""Add a simple remote link from an issue to web resource.
This avoids the admin access problems from add_remote_link by just
using a simple object and presuming all fields are correct and not
requiring more complex ``application`` data.... |
Get a list of the transitions available on the specified issue to the current user.
:param issue: ID or key of the issue to get the transitions from
:param id: if present, get only the transition matching this ID
:param expand: extra information to fetch inside each transition | def transitions(self, issue, id=None, expand=None):
"""Get a list of the transitions available on the specified issue to the current user.
:param issue: ID or key of the issue to get the transitions from
:param id: if present, get only the transition matching this ID
:param expand: extr... |
Get a transitionid available on the specified issue to the current user.
Look at https://developer.atlassian.com/static/rest/jira/6.1.html#d2e1074 for json reference
:param issue: ID or key of the issue to get the transitions from
:param trans_name: iname of transition we are looking for | def find_transitionid_by_name(self, issue, transition_name):
"""Get a transitionid available on the specified issue to the current user.
Look at https://developer.atlassian.com/static/rest/jira/6.1.html#d2e1074 for json reference
:param issue: ID or key of the issue to get the transitions from... |
Perform a transition on an issue.
Each keyword argument (other than the predefined ones) is treated as a field name and the argument's value
is treated as the intended value for that field -- if the fields argument is used, all other keyword arguments
will be ignored. Field values will be set o... | def transition_issue(self, issue, transition, fields=None, comment=None, worklog=None, **fieldargs):
"""Perform a transition on an issue.
Each keyword argument (other than the predefined ones) is treated as a field name and the argument's value
is treated as the intended value for that field --... |
Register a vote for the current authenticated user on an issue.
:param issue: ID or key of the issue to vote on
:rtype: Response | def add_vote(self, issue):
"""Register a vote for the current authenticated user on an issue.
:param issue: ID or key of the issue to vote on
:rtype: Response
"""
url = self._get_url('issue/' + str(issue) + '/votes')
return self._session.post(url) |
Remove the current authenticated user's vote from an issue.
:param issue: ID or key of the issue to remove vote on | def remove_vote(self, issue):
"""Remove the current authenticated user's vote from an issue.
:param issue: ID or key of the issue to remove vote on
"""
url = self._get_url('issue/' + str(issue) + '/votes')
self._session.delete(url) |
Add a user to an issue's watchers list.
:param issue: ID or key of the issue affected
:param watcher: username of the user to add to the watchers list | def add_watcher(self, issue, watcher):
"""Add a user to an issue's watchers list.
:param issue: ID or key of the issue affected
:param watcher: username of the user to add to the watchers list
"""
url = self._get_url('issue/' + str(issue) + '/watchers')
self._session.pos... |
Remove a user from an issue's watch list.
:param issue: ID or key of the issue affected
:param watcher: username of the user to remove from the watchers list
:rtype: Response | def remove_watcher(self, issue, watcher):
"""Remove a user from an issue's watch list.
:param issue: ID or key of the issue affected
:param watcher: username of the user to remove from the watchers list
:rtype: Response
"""
url = self._get_url('issue/' + str(issue) + '/w... |
Get a list of worklog Resources from the server for an issue.
:param issue: ID or key of the issue to get worklogs from
:rtype: List[Worklog] | def worklogs(self, issue):
"""Get a list of worklog Resources from the server for an issue.
:param issue: ID or key of the issue to get worklogs from
:rtype: List[Worklog]
"""
r_json = self._get_json('issue/' + str(issue) + '/worklog')
worklogs = [Worklog(self._options, ... |
Add a new worklog entry on an issue and return a Resource for it.
:param issue: the issue to add the worklog to
:param timeSpent: a worklog entry with this amount of time spent, e.g. "2d"
:param adjustEstimate: (optional) allows the user to provide specific instructions to update the remaining
... | def add_worklog(self,
issue,
timeSpent=None,
timeSpentSeconds=None,
adjustEstimate=None,
newEstimate=None,
reduceBy=None,
comment=None,
started=None,
... |
Create a link between two issues.
:param type: the type of link to create
:param inwardIssue: the issue to link from
:param outwardIssue: the issue to link to
:param comment: a comment to add to the issues with the link. Should be
a dict containing ``body`` and ``visibility... | def create_issue_link(self, type, inwardIssue, outwardIssue, comment=None):
"""Create a link between two issues.
:param type: the type of link to create
:param inwardIssue: the issue to link from
:param outwardIssue: the issue to link to
:param comment: a comment to add to the ... |
Delete a link between two issues.
:param id: ID of the issue link to delete | def delete_issue_link(self, id):
"""Delete a link between two issues.
:param id: ID of the issue link to delete
"""
url = self._get_url('issueLink') + "/" + id
return self._session.delete(url) |
Get a list of issue link type Resources from the server.
:rtype: List[IssueLinkType] | def issue_link_types(self):
"""Get a list of issue link type Resources from the server.
:rtype: List[IssueLinkType]
"""
r_json = self._get_json('issueLinkType')
link_types = [IssueLinkType(self._options, self._session, raw_link_json) for raw_link_json in
r_... |
Get a list of issue type Resources from the server.
:rtype: List[IssueType] | def issue_types(self):
"""Get a list of issue type Resources from the server.
:rtype: List[IssueType]
"""
r_json = self._get_json('issuetype')
issue_types = [IssueType(
self._options, self._session, raw_type_json) for raw_type_json in r_json]
return issue_ty... |
:param name: Name of the issue type
:type name: str
:rtype: IssueType | def issue_type_by_name(self, name):
"""
:param name: Name of the issue type
:type name: str
:rtype: IssueType
"""
issue_types = self.issue_types()
try:
issue_type = [it for it in issue_types if it.name == name][0]
except IndexError:
... |
Returns request types supported by a service desk instance.
:param service_desk: The service desk instance.
:type service_desk: ServiceDesk
:rtype: List[RequestType] | def request_types(self, service_desk):
""" Returns request types supported by a service desk instance.
:param service_desk: The service desk instance.
:type service_desk: ServiceDesk
:rtype: List[RequestType]
"""
if hasattr(service_desk, 'id'):
service_desk = ... |
Get a dict of all available permissions on the server.
:param projectKey: limit returned permissions to the specified project
:type projectKey: Optional[str]
:param projectId: limit returned permissions to the specified project
:type projectId: Optional[str]
:param issueKey: lim... | def my_permissions(self,
projectKey=None,
projectId=None,
issueKey=None,
issueId=None,
):
"""Get a dict of all available permissions on the server.
:param projectKey: limit returned permis... |
Get a list of priority Resources from the server.
:rtype: List[Priority] | def priorities(self):
"""Get a list of priority Resources from the server.
:rtype: List[Priority]
"""
r_json = self._get_json('priority')
priorities = [Priority(
self._options, self._session, raw_priority_json) for raw_priority_json in r_json]
return priorit... |
Get a list of project Resources from the server visible to the current authenticated user.
:rtype: List[Project] | def projects(self):
"""Get a list of project Resources from the server visible to the current authenticated user.
:rtype: List[Project]
"""
r_json = self._get_json('project')
projects = [Project(
self._options, self._session, raw_project_json) for raw_project_json i... |
Register an image file as a project avatar.
The avatar created is temporary and must be confirmed before it can
be used.
Avatar images are specified by a filename, size, and file object. By default, the client will attempt to
autodetect the picture's content type: this mechanis... | def create_temp_project_avatar(self, project, filename, size, avatar_img, contentType=None, auto_confirm=False):
"""Register an image file as a project avatar.
The avatar created is temporary and must be confirmed before it can
be used.
Avatar images are specified by a filename, si... |
Confirm the temporary avatar image previously uploaded with the specified cropping.
After a successful registry with :py:meth:`create_temp_project_avatar`, use this method to confirm the avatar
for use. The final avatar can be a subarea of the uploaded image, which is customized with the
``crop... | def confirm_project_avatar(self, project, cropping_properties):
"""Confirm the temporary avatar image previously uploaded with the specified cropping.
After a successful registry with :py:meth:`create_temp_project_avatar`, use this method to confirm the avatar
for use. The final avatar can be a... |
Set a project's avatar.
:param project: ID or key of the project to set the avatar on
:param avatar: ID of the avatar to set | def set_project_avatar(self, project, avatar):
"""Set a project's avatar.
:param project: ID or key of the project to set the avatar on
:param avatar: ID of the avatar to set
"""
self._set_avatar(
None, self._get_url('project/' + project + '/avatar'), avatar) |
Delete a project's avatar.
:param project: ID or key of the project to delete the avatar from
:param avatar: ID of the avatar to delete | def delete_project_avatar(self, project, avatar):
"""Delete a project's avatar.
:param project: ID or key of the project to delete the avatar from
:param avatar: ID of the avatar to delete
"""
url = self._get_url('project/' + project + '/avatar/' + avatar)
return self._s... |
Get a list of component Resources present on a project.
:param project: ID or key of the project to get components from
:type project: str
:rtype: List[Component] | def project_components(self, project):
"""Get a list of component Resources present on a project.
:param project: ID or key of the project to get components from
:type project: str
:rtype: List[Component]
"""
r_json = self._get_json('project/' + project + '/components')
... |
Get a list of version Resources present on a project.
:param project: ID or key of the project to get versions from
:type project: str
:rtype: List[Version] | def project_versions(self, project):
"""Get a list of version Resources present on a project.
:param project: ID or key of the project to get versions from
:type project: str
:rtype: List[Version]
"""
r_json = self._get_json('project/' + project + '/versions')
ve... |
Get a version Resource by its name present on a project.
:param project: ID or key of the project to get versions from
:type project: str
:param version_name: name of the version to search for
:type version_name: str
:rtype: Optional[Version] | def get_project_version_by_name(self, project, version_name):
"""Get a version Resource by its name present on a project.
:param project: ID or key of the project to get versions from
:type project: str
:param version_name: name of the version to search for
:type version_name: s... |
Rename a version Resource on a project.
:param project: ID or key of the project to get versions from
:type project: str
:param old_name: old name of the version to rename
:type old_name: str
:param new_name: new name of the version to rename
:type new_name: str
... | def rename_version(self, project, old_name, new_name):
"""Rename a version Resource on a project.
:param project: ID or key of the project to get versions from
:type project: str
:param old_name: old name of the version to rename
:type old_name: str
:param new_name: new ... |
Get a dict of role names to resource locations for a project.
:param project: ID or key of the project to get roles from | def project_roles(self, project):
"""Get a dict of role names to resource locations for a project.
:param project: ID or key of the project to get roles from
"""
path = 'project/' + project + '/role'
_rolesdict = self._get_json(path)
rolesdict = {}
for k, v in _... |
Get a role Resource.
:param project: ID or key of the project to get the role from
:param id: ID of the role to get | def project_role(self, project, id):
"""Get a role Resource.
:param project: ID or key of the project to get the role from
:param id: ID of the role to get
"""
if isinstance(id, Number):
id = "%s" % id
return self._find_for_resource(Role, (project, id)) |
Get a list of resolution Resources from the server.
:rtype: List[Resolution] | def resolutions(self):
"""Get a list of resolution Resources from the server.
:rtype: List[Resolution]
"""
r_json = self._get_json('resolution')
resolutions = [Resolution(
self._options, self._session, raw_res_json) for raw_res_json in r_json]
return resolut... |
Get a :class:`~jira.client.ResultList` of issue Resources matching a JQL search string.
:param jql_str: The JQL search string.
:type jql_str: str
:param startAt: Index of the first issue to return. (Default: 0)
:type startAt: int
:param maxResults: Maximum number of issues to re... | def search_issues(self,
jql_str,
startAt=0,
maxResults=50,
validate_query=True,
fields=None,
expand=None,
json_result=None,
):
"""Get a ... |
Get a dict of server information for this JIRA instance.
:rtype: Dict[str, Any] | def server_info(self):
"""Get a dict of server information for this JIRA instance.
:rtype: Dict[str, Any]
"""
retry = 0
j = self._get_json('serverInfo')
while not j and retry < 3:
logging.warning("Bug https://jira.atlassian.com/browse/JRA-59676 trying again...... |
Get a list of status Resources from the server.
:rtype: List[Status] | def statuses(self):
"""Get a list of status Resources from the server.
:rtype: List[Status]
"""
r_json = self._get_json('status')
statuses = [Status(self._options, self._session, raw_stat_json)
for raw_stat_json in r_json]
return statuses |
Get a list of status category Resources from the server.
:rtype: List[StatusCategory] | def statuscategories(self):
"""Get a list of status category Resources from the server.
:rtype: List[StatusCategory]
"""
r_json = self._get_json('statuscategory')
statuscategories = [StatusCategory(self._options, self._session, raw_stat_json)
for raw_... |
Get a user Resource from the server.
:param id: ID of the user to get
:param id: str
:param expand: Extra information to fetch inside each resource
:type expand: Optional[Any]
:rtype: User | def user(self, id, expand=None):
"""Get a user Resource from the server.
:param id: ID of the user to get
:param id: str
:param expand: Extra information to fetch inside each resource
:type expand: Optional[Any]
:rtype: User
"""
user = User(self._options... |
Get a list of user Resources that match the search string and can be assigned issues for projects.
:param username: A string to match usernames against
:type username: str
:param projectKeys: Comma-separated list of project keys to check for issue assignment permissions
:type projectKey... | def search_assignable_users_for_projects(self, username, projectKeys, startAt=0, maxResults=50):
"""Get a list of user Resources that match the search string and can be assigned issues for projects.
:param username: A string to match usernames against
:type username: str
:param projectK... |
Get a list of user Resources that match the search string for assigning or creating issues.
This method is intended to find users that are eligible to create issues in a project or be assigned
to an existing issue. When searching for eligible creators, specify a project. When searching for eligible
... | def search_assignable_users_for_issues(self,
username,
project=None,
issueKey=None,
expand=None,
startAt=... |
Register an image file as a user avatar.
The avatar created is temporary and must be confirmed before it can
be used.
Avatar images are specified by a filename, size, and file object. By default, the client will attempt to
autodetect the picture's content type: this mechanism relies on... | def create_temp_user_avatar(self,
user,
filename,
size,
avatar_img,
contentType=None,
auto_confirm=False,
... |
Confirm the temporary avatar image previously uploaded with the specified cropping.
After a successful registry with :py:meth:`create_temp_user_avatar`, use this method to confirm the avatar for
use. The final avatar can be a subarea of the uploaded image, which is customized with the
``croppin... | def confirm_user_avatar(self, user, cropping_properties):
"""Confirm the temporary avatar image previously uploaded with the specified cropping.
After a successful registry with :py:meth:`create_temp_user_avatar`, use this method to confirm the avatar for
use. The final avatar can be a subarea ... |
Set a user's avatar.
:param username: the user to set the avatar for
:param avatar: ID of the avatar to set | def set_user_avatar(self, username, avatar):
"""Set a user's avatar.
:param username: the user to set the avatar for
:param avatar: ID of the avatar to set
"""
self._set_avatar(
{'username': username}, self._get_url('user/avatar'), avatar) |
Delete a user's avatar.
:param username: the user to delete the avatar from
:param avatar: ID of the avatar to remove | def delete_user_avatar(self, username, avatar):
"""Delete a user's avatar.
:param username: the user to delete the avatar from
:param avatar: ID of the avatar to remove
"""
params = {'username': username}
url = self._get_url('user/avatar/' + avatar)
return self._... |
Get a list of user Resources that match the specified search string.
:param user: a string to match usernames, name or email against.
:type user: str
:param startAt: index of the first user to return.
:type startAt: int
:param maxResults: maximum number of users to return.
... | def search_users(self, user, startAt=0, maxResults=50, includeActive=True, includeInactive=False):
"""Get a list of user Resources that match the specified search string.
:param user: a string to match usernames, name or email against.
:type user: str
:param startAt: index of the first ... |
Get a list of user Resources that match a username string and have browse permission for the issue or project.
:param user: a string to match usernames against.
:type user: str
:param issueKey: find users with browse permission for this issue.
:type issueKey: Optional[str]
:para... | def search_allowed_users_for_issue(self, user, issueKey=None, projectKey=None, startAt=0, maxResults=50):
"""Get a list of user Resources that match a username string and have browse permission for the issue or project.
:param user: a string to match usernames against.
:type user: str
:... |
Create a version in a project and return a Resource for it.
:param name: name of the version to create
:type name: str
:param project: key of the project to create the version in
:type project: str
:param description: a description of the version
:type description: str
... | def create_version(self,
name,
project,
description=None,
releaseDate=None,
startDate=None,
archived=False,
released=False,
):
"... |
Move a version within a project's ordered version list and return a new version Resource for it.
One, but not both, of ``after`` and ``position`` must be specified.
:param id: ID of the version to move
:param after: the self attribute of a version to place the specified version after (that is,... | def move_version(self, id, after=None, position=None):
"""Move a version within a project's ordered version list and return a new version Resource for it.
One, but not both, of ``after`` and ``position`` must be specified.
:param id: ID of the version to move
:param after: the self att... |
Get a version Resource.
:param id: ID of the version to get
:type id: str
:param expand: extra information to fetch inside each resource
:type expand: Optional[Any]
:rtype: Version | def version(self, id, expand=None):
"""Get a version Resource.
:param id: ID of the version to get
:type id: str
:param expand: extra information to fetch inside each resource
:type expand: Optional[Any]
:rtype: Version
"""
version = Version(self._option... |
Get a dict of the current authenticated user's session information.
:param auth: Tuple of username and password.
:type auth: Optional[Tuple[str,str]]
:rtype: User | def session(self, auth=None):
"""Get a dict of the current authenticated user's session information.
:param auth: Tuple of username and password.
:type auth: Optional[Tuple[str,str]]
:rtype: User
"""
url = '{server}{auth_url}'.format(**self._options)
if isinst... |
Destroy the user's current WebSudo session.
Works only for non-cloud deployments, for others does nothing.
:rtype: Optional[Any] | def kill_websudo(self):
"""Destroy the user's current WebSudo session.
Works only for non-cloud deployments, for others does nothing.
:rtype: Optional[Any]
"""
if self.deploymentType != 'Cloud':
url = self._options['server'] + '/rest/auth/1/websudo'
retu... |
Creates a basic http session.
:param username: Username for the session
:type username: str
:param password: Password for the username
:type password: str
:param timeout: If set determines the timeout period for the Session.
:type timeout: Optional[int]
:rtype: ... | def _create_http_basic_session(self, username, password, timeout=None):
""" Creates a basic http session.
:param username: Username for the session
:type username: str
:param password: Password for the username
:type password: str
:param timeout: If set determines the ti... |
Returns the full url based on JIRA base url and the path provided
:param path: The subpath desired.
:type path: str
:param base: The base url which should be prepended to the path
:type base: Optional[str]
:return Fully qualified URL
:rtype: str | def _get_url(self, path, base=JIRA_BASE_URL):
""" Returns the full url based on JIRA base url and the path provided
:param path: The subpath desired.
:type path: str
:param base: The base url which should be prepended to the path
:type base: Optional[str]
:return Fully ... |
Get the json for a given path and params.
:param path: The subpath required
:type path: str
:param params: Parameters to filter the json query.
:type params: Optional[Dict[str, Any]]
:param base: The Base JIRA URL, defaults to the instance base.
:type base: Optional[str]... | def _get_json(self,
path,
params=None,
base=JIRA_BASE_URL,
):
"""Get the json for a given path and params.
:param path: The subpath required
:type path: str
:param params: Parameters to filter the json query.
... |
Get the MIME type for a given stream of bytes
:param buff: Stream of bytes
:type buff: bytes
:rtype: str | def _get_mime_type(self, buff):
"""Get the MIME type for a given stream of bytes
:param buff: Stream of bytes
:type buff: bytes
:rtype: str
"""
if self._magic is not None:
return self._magic.id_buffer(buff)
else:
try:
ret... |
Rename a JIRA user.
:param old_user: Old username login
:type old_user: str
:param new_user: New username login
:type new_user: str | def rename_user(self, old_user, new_user):
"""Rename a JIRA user.
:param old_user: Old username login
:type old_user: str
:param new_user: New username login
:type new_user: str
"""
if self._version > (6, 0, 0):
url = self._options['server'] + '/rest... |
Deletes a JIRA User.
:param username: Username to delete
:type username: str
:return: Success of user deletion
:rtype: bool | def delete_user(self, username):
"""Deletes a JIRA User.
:param username: Username to delete
:type username: str
:return: Success of user deletion
:rtype: bool
"""
url = self._options['server'] + '/rest/api/latest/user/?username=%s' % username
r = sel... |
Disable/deactivate the user.
:param username: User to be deactivated.
:type username: str
:rtype: Union[str, int] | def deactivate_user(self, username):
"""Disable/deactivate the user.
:param username: User to be deactivated.
:type username: str
:rtype: Union[str, int]
"""
if self.deploymentType == 'Cloud':
# Disabling users now needs cookie auth in the Cloud - see https:... |
Start jira re-indexing. Returns True if reindexing is in progress or not needed, or False.
If you call reindex() without any parameters it will perform a background reindex only if JIRA thinks it should do it.
:param force: reindex even if JIRA doesn't say this is needed, False by default.
:pa... | def reindex(self, force=False, background=True):
"""Start jira re-indexing. Returns True if reindexing is in progress or not needed, or False.
If you call reindex() without any parameters it will perform a background reindex only if JIRA thinks it should do it.
:param force: reindex even if JI... |
Will call jira export to backup as zipped xml. Returning with success does not mean that the backup process finished. | def backup(self, filename='backup.zip', attachments=False):
"""Will call jira export to backup as zipped xml. Returning with success does not mean that the backup process finished."""
if self.deploymentType == 'Cloud':
url = self._options['server'] + '/rest/backup/1/export/runbackup'
... |
Return status of cloud backup as a dict.
Is there a way to get progress for Server version? | def backup_progress(self):
"""Return status of cloud backup as a dict.
Is there a way to get progress for Server version?
"""
epoch_time = int(time.time() * 1000)
if self.deploymentType == 'Cloud':
url = self._options['server'] + '/rest/obm/1.0/getprogress?_=%i' % ep... |
Return boolean based on 'alternativePercentage' and 'size' returned from backup_progress (cloud only). | def backup_complete(self):
"""Return boolean based on 'alternativePercentage' and 'size' returned from backup_progress (cloud only)."""
if self.deploymentType != 'Cloud':
logging.warning(
'This functionality is not available in Server version')
return None
... |
Download backup file from WebDAV (cloud only). | def backup_download(self, filename=None):
"""Download backup file from WebDAV (cloud only)."""
if self.deploymentType != 'Cloud':
logging.warning(
'This functionality is not available in Server version')
return None
remote_file = self.backup_progress()['fi... |
Returns the username of the current user.
:rtype: str | def current_user(self):
"""Returns the username of the current user.
:rtype: str
"""
if not hasattr(self, '_serverInfo') or 'username' not in self._serverInfo:
url = self._get_url('serverInfo')
r = self._session.get(url, headers=self._options['headers'])
... |
Delete project from Jira.
:param pid: JIRA projectID or Project or slug
:type pid: str
:return: True if project was deleted
:rtype: bool
:raises JIRAError: If project not found or not enough permissions
:raises ValueError: If pid parameter is not Project, slug or Projec... | def delete_project(self, pid):
"""Delete project from Jira.
:param pid: JIRA projectID or Project or slug
:type pid: str
:return: True if project was deleted
:rtype: bool
:raises JIRAError: If project not found or not enough permissions
:raises ValueError: If pi... |
Create a project with the specified parameters.
:param key: Mandatory. Must match JIRA project key requirements, usually only 2-10 uppercase characters.
:type: str
:param name: If not specified it will use the key value.
:type name: Optional[str]
:param assignee: If not specifie... | def create_project(self, key, name=None, assignee=None, type="Software", template_name=None):
"""Create a project with the specified parameters.
:param key: Mandatory. Must match JIRA project key requirements, usually only 2-10 uppercase characters.
:type: str
:param name: If not specif... |
Create a new JIRA user.
:param username: the username of the new user
:type username: str
:param email: email address of the new user
:type email: str
:param directoryId: The directory ID the new user should be a part of (Default: 1)
:type directoryId: int
:param... | def add_user(self,
username,
email,
directoryId=1,
password=None,
fullname=None,
notify=False,
active=True,
ignore_existing=False,
application_keys=None,
... |
Add a user to an existing group.
:param username: Username that will be added to specified group.
:type username: str
:param group: Group that the user will be added to.
:type group: str
:return: json response from Jira server for success or a value that evaluates as False in c... | def add_user_to_group(self, username, group):
"""Add a user to an existing group.
:param username: Username that will be added to specified group.
:type username: str
:param group: Group that the user will be added to.
:type group: str
:return: json response from Jira s... |
Remove a user from a group.
:param username: The user to remove from the group.
:param groupname: The group that the user will be removed from. | def remove_user_from_group(self, username, groupname):
"""Remove a user from a group.
:param username: The user to remove from the group.
:param groupname: The group that the user will be removed from.
"""
url = self._options['server'] + '/rest/api/latest/group/user'
x =... |
Get a list of board resources.
:param startAt: The starting index of the returned boards. Base index: 0.
:param maxResults: The maximum number of boards to return per page. Default: 50
:param type: Filters results to boards of the specified type. Valid values: scrum, kanban.
:param name... | def boards(self, startAt=0, maxResults=50, type=None, name=None, projectKeyOrID=None):
"""Get a list of board resources.
:param startAt: The starting index of the returned boards. Base index: 0.
:param maxResults: The maximum number of boards to return per page. Default: 50
:param type:... |
Get a list of sprint GreenHopperResources.
:param board_id: the board to get sprints from
:param extended: Used only by old GreenHopper API to fetch additional information like
startDate, endDate, completeDate, much slower because it requires an additional requests for each sprint.
... | def sprints(self, board_id, extended=False, startAt=0, maxResults=50, state=None):
"""Get a list of sprint GreenHopperResources.
:param board_id: the board to get sprints from
:param extended: Used only by old GreenHopper API to fetch additional information like
startDate, endDate, ... |
Return the total incompleted points this sprint. | def incompletedIssuesEstimateSum(self, board_id, sprint_id):
"""Return the total incompleted points this sprint."""
return self._get_json('rapid/charts/sprintreport?rapidViewId=%s&sprintId=%s' % (board_id, sprint_id),
base=self.AGILE_BASE_URL)['contents']['incompletedIssues... |
Return the completed issues for the sprint. | def removed_issues(self, board_id, sprint_id):
"""Return the completed issues for the sprint."""
r_json = self._get_json('rapid/charts/sprintreport?rapidViewId=%s&sprintId=%s' % (board_id, sprint_id),
base=self.AGILE_BASE_URL)
issues = [Issue(self._options, self._... |
Return the total incompleted points this sprint. | def removedIssuesEstimateSum(self, board_id, sprint_id):
"""Return the total incompleted points this sprint."""
return self._get_json('rapid/charts/sprintreport?rapidViewId=%s&sprintId=%s' % (board_id, sprint_id),
base=self.AGILE_BASE_URL)['contents']['puntedIssuesEstimateS... |
Return the information about a sprint.
:param board_id: the board retrieving issues from. Deprecated and ignored.
:param sprint_id: the sprint retrieving issues from | def sprint_info(self, board_id, sprint_id):
"""Return the information about a sprint.
:param board_id: the board retrieving issues from. Deprecated and ignored.
:param sprint_id: the sprint retrieving issues from
"""
sprint = Sprint(self._options, self._session)
sprint.f... |
Return the information about a sprint.
:param sprint_id: the sprint retrieving issues from
:type sprint_id: int
:rtype: :class:`~jira.resources.Sprint` | def sprint(self, id):
"""Return the information about a sprint.
:param sprint_id: the sprint retrieving issues from
:type sprint_id: int
:rtype: :class:`~jira.resources.Sprint`
"""
sprint = Sprint(self._options, self._session)
sprint.find(id)
return spr... |
Delete an agile board. | def delete_board(self, id):
"""Delete an agile board."""
board = Board(self._options, self._session, raw={'id': id})
board.delete() |
Create a new board for the ``project_ids``.
:param name: name of the board
:type name: str
:param project_ids: the projects to create the board in
:type project_ids: str
:param preset: What preset to use for this board. (Default: "scrum")
:type preset: 'kanban', 'scrum',... | def create_board(self, name, project_ids, preset="scrum",
location_type='user', location_id=None):
"""Create a new board for the ``project_ids``.
:param name: name of the board
:type name: str
:param project_ids: the projects to create the board in
:type pro... |
Create a new sprint for the ``board_id``.
:param name: Name of the sprint
:type name: str
:param board_id: Which board the sprint should be assigned.
:type board_id: int
:param startDate: Start date for the sprint.
:type startDate: Optional[Any]
:param endDate: E... | def create_sprint(self, name, board_id, startDate=None, endDate=None):
"""Create a new sprint for the ``board_id``.
:param name: Name of the sprint
:type name: str
:param board_id: Which board the sprint should be assigned.
:type board_id: int
:param startDate: Start dat... |
Add the issues in ``issue_keys`` to the ``sprint_id``.
The sprint must be started but not completed.
If a sprint was completed, then have to also edit the history of the
issue so that it was added to the sprint before it was completed,
preferably before it started. A completed sprint's... | def add_issues_to_sprint(self, sprint_id, issue_keys):
"""Add the issues in ``issue_keys`` to the ``sprint_id``.
The sprint must be started but not completed.
If a sprint was completed, then have to also edit the history of the
issue so that it was added to the sprint before it was com... |
Add the issues in ``issue_keys`` to the ``epic_id``.
:param epic_id: The ID for the epic where issues should be added.
:type epic_id: int
:param issue_keys: The issues to add to the epic
:type issue_keys: str
:param ignore_epics: ignore any issues listed in ``issue_keys`` that a... | def add_issues_to_epic(self, epic_id, issue_keys, ignore_epics=True):
"""Add the issues in ``issue_keys`` to the ``epic_id``.
:param epic_id: The ID for the epic where issues should be added.
:type epic_id: int
:param issue_keys: The issues to add to the epic
:type issue_keys: s... |
Rank an issue before another using the default Ranking field, the one named 'Rank'.
:param issue: issue key of the issue to be ranked before the second one.
:param next_issue: issue key of the second issue. | def rank(self, issue, next_issue):
"""Rank an issue before another using the default Ranking field, the one named 'Rank'.
:param issue: issue key of the issue to be ranked before the second one.
:param next_issue: issue key of the second issue.
"""
if not self._rank:
... |
Convert a dictionary into a Jira Resource object.
Recursively walks a dict structure, transforming the properties into attributes
on a new ``Resource`` object of the appropriate type (if a ``self`` link is present)
or a ``PropertyHolder`` object (if no ``self`` link is present). | def dict2resource(raw, top=None, options=None, session=None):
"""Convert a dictionary into a Jira Resource object.
Recursively walks a dict structure, transforming the properties into attributes
on a new ``Resource`` object of the appropriate type (if a ``self`` link is present)
or a ``PropertyHolder``... |
Finds a resource based on the input parameters.
:type id: Union[Tuple[str, str], int, str]
:type params: Optional[Dict[str, str]] | def find(self,
id,
params=None,
):
"""Finds a resource based on the input parameters.
:type id: Union[Tuple[str, str], int, str]
:type params: Optional[Dict[str, str]]
"""
if params is None:
params = {}
if isinstance(... |
Gets the url for the specified path.
:type path: str
:rtype: str | def _get_url(self, path):
""" Gets the url for the specified path.
:type path: str
:rtype: str
"""
options = self._options.copy()
options.update({'path': path})
return self._base_url.format(**options) |
Update this resource on the server.
Keyword arguments are marshalled into a dict before being sent. If this
resource doesn't support ``PUT``, a :py:exc:`.JIRAError` will be raised; subclasses that specialize this method
will only raise errors in case of user error.
:param fields: Field... | def update(self, fields=None, async_=None, jira=None, notify=True, **kwargs):
"""Update this resource on the server.
Keyword arguments are marshalled into a dict before being sent. If this
resource doesn't support ``PUT``, a :py:exc:`.JIRAError` will be raised; subclasses that specialize this m... |
Delete this resource from the server, passing the specified query parameters.
If this resource doesn't support ``DELETE``, a :py:exc:`.JIRAError`
will be raised; subclasses that specialize this method will only raise errors
in case of user error.
:param params: Parameters for the delet... | def delete(self, params=None):
"""Delete this resource from the server, passing the specified query parameters.
If this resource doesn't support ``DELETE``, a :py:exc:`.JIRAError`
will be raised; subclasses that specialize this method will only raise errors
in case of user error.
... |
Load a resource.
:type url: str
:type headers: CaseInsensitiveDict
:type params: Optional[Dict[str,str]]
:type path: Optional[str] | def _load(self,
url,
headers=CaseInsensitiveDict(),
params=None,
path=None,
):
""" Load a resource.
:type url: str
:type headers: CaseInsensitiveDict
:type params: Optional[Dict[str,str]]
:type path: Optional[... |
Parse a raw dictionary to create a resource.
:type raw: Dict[str, Any] | def _parse_raw(self, raw):
"""Parse a raw dictionary to create a resource.
:type raw: Dict[str, Any]
"""
self.raw = raw
if not raw:
raise NotImplementedError("We cannot instantiate empty resources: %s" % raw)
dict2resource(raw, self, self._options, self._sess... |
Return the file content as a string. | def get(self):
"""Return the file content as a string."""
r = self._session.get(self.content, headers={'Accept': '*/*'})
return r.content |
Return the file content as an iterable stream. | def iter_content(self, chunk_size=1024):
"""Return the file content as an iterable stream."""
r = self._session.get(self.content, stream=True)
return r.iter_content(chunk_size) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.