Skip to content

Instantly share code, notes, and snippets.

@smd877
Created October 27, 2020 13:56
Show Gist options
  • Save smd877/7024ff8755f3e534606625e027d7fd14 to your computer and use it in GitHub Desktop.
Save smd877/7024ff8755f3e534606625e027d7fd14 to your computer and use it in GitHub Desktop.
Python3系でdateコマンドの結果をbacklogのチケットコメントに投稿するサンプル
import subprocess
import urllib.request, urllib.parse
DOMAIN = 'https://[スペースID].backlog.jp'
API_KEY = '[APIキー]'
TICKET_ID = '[チケットID]'
API_URL = DOMAIN + '/api/v2/issues/' + TICKET_ID + '/comments?apiKey=' + API_KEY
contents = {
'content' : subprocess.check_output("date").decode()
}
req = urllib.request.Request(API_URL, data=urllib.parse.urlencode(contents).encode(), method='POST')
res = urllib.request.urlopen(req)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment