Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Make an issue on github using API V3 and Python
import json
import requests
# Authentication for user filing issue (must have read/write access to
# repository to add issue to)
# The repository to add this issue to
def make_github_issue(title, body=None, assignee=None, milestone=None, labels=None):
'''Create an issue on using the given parameters.'''
# Our url to create issues via POST
url = '' % (REPO_OWNER, REPO_NAME)
# Create an authenticated session to create the issue
session = requests.session(auth=(USERNAME, PASSWORD))
# Create our issue
issue = {'title': title,
'body': body,
'assignee': assignee,
'milestone': milestone,
'labels': labels}
# Add the issue to our repository
r =, json.dumps(issue))
if r.status_code == 201:
print 'Successfully created Issue "%s"' % title
print 'Could not create Issue "%s"' % title
print 'Response:', r.content
make_github_issue('Issue Title', 'Body text', 'assigned_user', 3, ['bug'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.