@@ -320,7 +320,8 @@ def create_key(self, title, key, read_only=False):
320
320
@requires_auth
321
321
def create_repository (self , name , description = '' , homepage = '' ,
322
322
private = False , has_issues = True , has_wiki = True ,
323
- auto_init = False , gitignore_template = '' ):
323
+ auto_init = False , gitignore_template = '' ,
324
+ organization = None ):
324
325
"""Create a repository for the authenticated user.
325
326
326
327
:param str name: (required), name of the repository
@@ -335,11 +336,16 @@ def create_repository(self, name, description='', homepage='',
335
336
:param bool auto_init: (optional), auto initialize the repository
336
337
:param str gitignore_template: (optional), name of the git template to
337
338
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.
338
341
:returns: :class:`Repository <github3.repos.Repository>`
339
342
340
343
.. warning: ``name`` should be no longer than 100 characters
341
344
"""
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' )
343
349
data = {'name' : name , 'description' : description ,
344
350
'homepage' : homepage , 'private' : private ,
345
351
'has_issues' : has_issues , 'has_wiki' : has_wiki ,
0 commit comments