8000 Added gist reference to import_issue and included code examples. · pythonthings/github3.py@ffd11d1 · GitHub
[go: up one dir, main page]

Skip to content

Commit ffd11d1

Browse files
Added gist reference to import_issue and included code examples.
1 parent 47b8057 commit ffd11d1

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

docs/examples/issue.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,32 @@ Or how to do the same by wrapping the lines in your terminal.
4949

5050
.. literalinclude:: source/wrap_text.py
5151
:language: python
52+
53+
Importing an issue
54+
------------------
55+
56+
Not only can you create new issues, but you can import existing ones. When importing, you preserve the timestamp creation date; you can preserve the timestamp(s) for comment(s) too.
57+
58+
::
59+
60+
import github3
61+
gh = github3.login(token=token)
62+
issue = {
63+
'title': 'Documentation issue',
64+
'body': 'Missing links in index.html',
65+
'created_at': '2011-03-11T17:00:40Z'
66+
}
67+
68+
repository = gh.repository(user, repo)
69+
repository.import_issue(**issue)
70+
71+
Status of imported issue
72+
~~~~~~~~~~~~~~~~~~~~~~~~
73+
74+
Here's how to check the status of the imported issue.
75+
76+
::
77+
78+
import github3
79+
issue = repository.imported_issue(issue_num)
80+
print issue.status

github3/repos/repo.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1282,7 +1282,9 @@ def imported_issue(self, imported_issue_id):
12821282
@requires_auth
12831283
def import_issue(self, title, body, created_at, assignee=None,
12841284
milestone=None, closed=None, labels=None, comments=None):
1285-
"""Import issue into this repository.
1285+
"""Import an issue into the repository.
1286+
1287+
See also: https://gist.github.com/jonmagic/5282384165e0f86ef105
12861288
12871289
:param string title: (required) Title of issue
12881290
:param string body: (required) Body of issue

0 commit comments

Comments
 (0)
0