Skip to content

Instantly share code, notes, and snippets.

@smd877
Created October 27, 2020 13:51
Show Gist options
  • Save smd877/44d8e041fb7e9f61a44e2ef1654b8ae5 to your computer and use it in GitHub Desktop.
Save smd877/44d8e041fb7e9f61a44e2ef1654b8ae5 to your computer and use it in GitHub Desktop.
Python2系でdateコマンドの結果をbacklogのチケットコメントに投稿するサンプル
import subprocess
import urllib, urllib2
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")
}
req = urllib2.Request(API_URL, urllib.urlencode(contents))
res = urllib2.urlopen(req)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment