8000 add support for organization when creating new repository. · sigmavirus24/github3.py@76702bf · GitHub
[go: up one dir, main page]

Skip to content

Commit 76702bf

Browse files
committed
add support for organization when creating new repository.
1 parent 338e65d commit 76702bf

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

AUTHORS.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,5 @@ Contributors
130130
- Dejan Svetec (@dsvetec)
131131

132132
- Billy Keyes (@bluekeyes)
133+
134+
- Piotr Wilkosz (@wilkpio)

github3/github.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,8 @@ def create_key(self, title, key, read_only=False):
320320
@requires_auth
321321
def create_repository(self, name, description='', homepage='',
322322
private=False, has_issues=True, has_wiki=True,
323-
auto_init=False, gitignore_template=''):
323+
auto_init=False, gitignore_template='',
324+
organization=None):
324325
"""Create a repository for the authenticated user.
325326
326327
:param str name: (required), name of the repository
@@ -335,11 +336,16 @@ def create_repository(self, name, description='', homepage='',
335336
:param bool auto_init: (optional), auto initialize the repository
336337
:param str gitignore_template: (optional), name of the git template to
337338
use; ignored if auto_init = False.
339+
:param str organization: (optional), creates repository for given organization.
340+
If organization is not set user repository will be created.
338341
:returns: :class:`Repository <github3.repos.Repository>`
339342
340343
.. warning: ``name`` should be no longer than 100 characters
341344
"""
342-
url = self._build_url('user', 'repos')
345+
if organization:
346+
url = self._build_url('orgs', organization, 'repos')
347+
else:
348+
url = self._build_url('user', 'repos')
343349
data = {'name': name, 'description': description,
344350
'homepage': homepage, 'private': private,
345351
'has_issues': has_issues, 'has_wiki': has_wiki,

0 commit comments

Comments
 (0)
0