2017-03-18 3 views
0

현재이 문제를 만들 때 python JIRA를 사용하고 있습니다. 문제가 발생한 후 특정 이메일 주소로 이메일을 보내고 싶습니다. 시도한 솔루션이 있지만 작동하지 않습니다.JIRA API 메일 보내기

jira = JIRA(options,basic_auth=('[email protected]','password')) 
jira.email_user('[email protected]', 'test email body', title='JIRA Notification') 

그러나 email_user에 대한 요청으로 인해 404 오류가 발생합니다. "죄송합니다. 죽은 링크를 발견했습니다." jira 문제가 생성되면 지정된 이메일 주소로 맞춤 이메일을 보내는 다른 방법을 아는 사람이 있습니까? JIRA Rest API를 통해이 작업을 수행하는 것을 선호합니다. 경우 다른 사람에

+0

는 문제 - 보내 관련 이메일? – yossiz74

+0

더 명확하게하기 위해 - JIRA에는 사용자에게 이메일을 보낼 API가 없습니다. python 전자 메일 기능을 사용하지 않으려면 @ yossiz74로 표시된대로 알림 스키마를 사용해야합니다. – ZeddZull

+0

알림 기능을위한 REST API가 있음을 조금 더 확인하지만 jira-python이 노출한다고 생각하지 않습니다. 그것. jira-python에 다른 API를 추가하는 것은 어렵지 않지만이 API의 스키마는 상당히 복잡합니다. – ZeddZull

답변

0

여기에이 문제를 가지고 당신이 (파이썬에서)을 JIRA의 나머지 API를 사용하여 사용자 정의 이메일을 보낼 수있는 방법입니다 : 단지 프로젝트의 통지 제도에 의존하지 왜

import requests 

url = "https://jiraserver.atlassian.net/rest/api/2/issue/{issue number or key}/notify" 

notify_data = { 
     "subject": "Duis eu justo eget augue iaculis fermentum.", 
     "textBody": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eget venenatis elit. Duis eu justo eget augue iaculis fermentum. Sed semper quam laoreet nisi egestas at posuere augue semper.", 
     "htmlBody": "Lorem ipsum <strong>dolor</strong> sit amet, consectetur adipiscing elit. Pellentesque eget venenatis elit. Duis eu justo eget augue iaculis fermentum. Sed semper quam laoreet nisi egestas at posuere augue semper.", 
     "to": { 
      "users": [ 
       { 
        "name": "JIRA user"}] #Make sure you set permission for receiving notifications from self in your profile if you use same user you are logged in as" 
     }, 

    } 

requests.post(url,auth=('jira username','jira password'), json=notify_data)