def assign_issue(jira: JIRA, issue: Issue, account_id: str): # pre-port # ref.https://github.com/pycontribs/jira/blob/master/jira/client.py#L1572 url = jira._options["server"] + "/rest/api/latest/issue/" + str(issue.key) + "/assignee" payload = {"accountId": account_id} r = jira._session.put(url, data=ujson.dumps(payload)) raise_on_error(r)
def json_loads(r): raise_on_error(r) if len(r.text): # r.status_code != 204: return json.loads(r.text) else: # json.loads() fails with empy bodies return {}
def json_loads(r): raise_on_error(r) if len(r.text): # r.status_code != 204: return json.loads(r.text) else: # json.loads() fails with empty bodies return {}
def json_loads(r): raise_on_error(r) try: return r.json() except ValueError: # json.loads() fails with empty bodies if not r.text: return {} raise
def json_loads(r: Optional[Response]) -> Any: """Attempts to load json the result of a response Args: r (Optional[Response]): The Response object Raises: JIRAError: via :py:func:`jira.resilientsession.raise_on_error` Returns: Union[List[Dict[str, Any]], Dict[str, Any]]: the json """ raise_on_error(r) # if 'r' is None, will raise an error here r = cast(Response, r) # tell mypy only Response-like are here try: return r.json() except ValueError: # json.loads() fails with empty bodies if not r.text: return {} raise