Skip to content

Instantly share code, notes, and snippets.

@tbrittoborges
Last active February 17, 2016 18:03
Show Gist options
  • Save tbrittoborges/524093cccf42d62b5fbc to your computer and use it in GitHub Desktop.
Save tbrittoborges/524093cccf42d62b5fbc to your computer and use it in GitHub Desktop.
automatically sends a github issue
import requests
data = {"title": "Found a bug", # str
"body": "I'm having a problem with this.", # str
"assignee": None, # username str or None
"milestone": 1, # int
"labels": ['label1']} # list of str
def submit_github_issue(data, token, username, repo):
headers = {'Content-Type':'application/json',
'Authorization': 'token {}'.format(token)}
url = "https://api.github.com/repos/{}/{}/issues".format
r = requests.post(url(username, repo),
headers=headers,
json=data)
r.raise_for_status()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment