Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb2d01f3

Browse files
author
Maryna Peresypkina
committed
use hellcat-preview to create child team
1 parent9a916c4 commitb2d01f3

File tree

8 files changed

+288
-5
lines changed

8 files changed

+288
-5
lines changed

‎src/github3/orgs.py

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,10 @@ class _Organization(models.GitHubCore):
431431
http://developer.github.com/v3/orgs/
432432
"""
433433

434+
PREVIEW_HEADERS= {
435+
"Accept":"application/vnd.github.hellcat-preview+json"
436+
}
437+
434438
class_name="_Organization"
435439

436440
# Filters available when listing members. Note: ``"2fa_disabled"``
@@ -709,7 +713,14 @@ def conceal_member(self, username):
709713
returnself._boolean(self._delete(url),204,404)
710714

711715
@requires_auth
712-
defcreate_team(self,name,repo_names=[],permission="pull"):
716+
defcreate_team(
717+
self,
718+
name,
719+
repo_names=[],
720+
permission="pull",
721+
parent_team_id=None,
722+
privacy="secret",
723+
):
713724
"""Create a new team and return it.
714725
715726
This only works if the authenticated user owns this organization.
@@ -727,6 +738,14 @@ def create_team(self, name, repo_names=[], permission="pull"):
727738
repositories accessible by this team
728739
- ``admin`` -- members can push, pull and administer
729740
repositories accessible by this team
741+
:param int parent_team_id:
742+
(optional), the ID of a team to set as the parent team.
743+
:param str privacy:
744+
(optional), options:
745+
746+
- ``secret`` -- (default) only visible to organization
747+
owners and members of this team
748+
- ``closed`` -- visible to all members of this organization
730749
:returns:
731750
the created team
732751
:rtype:
@@ -736,9 +755,18 @@ def create_team(self, name, repo_names=[], permission="pull"):
736755
"name":name,
737756
"repo_names":repo_names,
738757
"permission":permission,
758+
"privacy":privacy,
739759
}
760+
headers= (
761+
self.PREVIEW_HEADERS
762+
ifparent_team_idorprivacy=="closed"
763+
elseNone
764+
)
765+
ifparent_team_id:
766+
data.update({"parent_team_id":parent_team_id})
767+
740768
url=self._build_url("teams",base_url=self._api)
741-
json=self._json(self._post(url,data),201)
769+
json=self._json(self._post(url,data,headers=headers),201)
742770
returnself._instance_or_null(Team,json)
743771

744772
@requires_auth
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"http_interactions": [{"request": {"body": {"encoding": "utf-8", "string": ""}, "headers": {"User-Agent": "github3.py/1.0.0a4", "Accept-Encoding": "gzip, deflate", "Accept": "application/vnd.github.v3.full+json", "Connection": "keep-alive", "Accept-Charset": "utf-8", "Content-Type": "application/json", "Authorization": "token <AUTH_TOKEN>"}, "method": "GET", "uri": "https://api.github.com/orgs/github3py"}, "response": {"body": {"encoding": "utf-8", "base64_string": "H4sIAAAAAAAAA51Ty66bMBD9lYp1wiuQB1LVbruourlSpW7QAAbcazyWbXKVRvn3jjFpuDcrurPHc+ZxzvE1ENhxGRRBx20/Vjt1CTYBb4IiORzTJN9vglELeu6tVaaIIlA89KlhjUOEujPREqqZQlOuwEQTgpqyM5N2HdRDCNsjvq6DTgi3qjEjWwf1EMIObKiYXgeeMdfIH25URo2V4HX5P9XeQ5dF4QwW9EchpqCJZwVHw3SN0hLvk5hjNIv+5fw5o8EaZmrNleXoDEIBCQN7WCWcvEJABfKyCHOkcEW+8iCBNcwlvkPDDcrNp5/fKIUNwJ216NiDKclKIPmfKbdUGn+z2pqgsHpkPmEyCreoL0/PMw/eSsXxH6cdN65GvAlaFALfSK3FjUsakd56O4gPTC0svnR3rRlY1pRgae40TtJtnG/Tw0ucFWle7Pa/aJdRNe9y8i2lJdlLkhXZsdjFLsdelCPyx2JlF0ULgnbjJBMr52VoPnyT1PM5fo88tiR6X8vRQEfVd04bIaBCDUSaX7ziQtDa5Z37TofQtiE4A4hw4DLs8Py1c8o4S9BQSgCpf71r32rGKGoU1NTjdNjn+zQ7nSjvaeyWetHchiij5jmB/Cm+OWu1MArrl5w1ZXqgr+XNJlG6Nvc/UYMsPfcPBGezO25/AeqFW1bFBAAA", "string": ""}, "headers": {"Date": "Sat, 16 Dec 2017 00:40:54 GMT", "Content-Type": "application/json; charset=utf-8", "Transfer-Encoding": "chunked", "Server": "GitHub.com", "Status": "200 OK", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4938", "X-RateLimit-Reset": "1513386481", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "ETag": "W/\"e2920ca56906d85fe22cd319143a421c\"", "Last-Modified": "Mon, 14 Dec 2015 14:48:30 GMT", "X-OAuth-Scopes": "admin:org, delete_repo, repo", "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", "X-GitHub-Media-Type": "github.v3; param=full; format=json", "Access-Control-Expose-Headers": "ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", "Access-Control-Allow-Origin": "*", "Content-Security-Policy": "default-src 'none'", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", "X-Content-Type-Options": "nosniff", "X-Frame-Options": "deny", "X-XSS-Protection": "1; mode=block", "X-Runtime-rack": "0.052747", "Content-Encoding": "gzip", "X-GitHub-Request-Id": "FEEA:266E1:3F3554A:4B2B5AC:5A346B96"}, "status": {"code": 200, "message": "OK"}, "url": "https://api.github.com/orgs/github3py"}, "recorded_at": "2017-12-16T00:40:54"}, {"request": {"body": {"encoding": "utf-8", "string": "{\"name\": \"temp-team\", \"repo_names\": [], \"permission\": \"pull\"}"}, "headers": {"User-Agent": "github3.py/1.0.0a4", "Accept-Encoding": "gzip, deflate", "Accept": "application/vnd.github.v3.full+json", "Connection": "keep-alive", "Accept-Charset": "utf-8", "Content-Type": "application/json", "Authorization": "token <AUTH_TOKEN>", "Content-Length": "61"}, "method": "POST", "uri": "https://api.github.com/orgs/github3py/teams"}, "response": {"body": {"encoding": "utf-8", "string": "{\"name\":\"temp-team\",\"id\":2589002,\"slug\":\"temp-team\",\"description\":null,\"privacy\":\"secret\",\"url\":\"https://api.github.com/teams/2589002\",\"members_url\":\"https://api.github.com/teams/2589002/members{/member}\",\"repositories_url\":\"https://api.github.com/teams/2589002/repos\",\"permission\":\"pull\",\"created_at\":\"2017-12-16T00:40:54Z\",\"updated_at\":\"2017-12-16T00:40:54Z\",\"members_count\":0,\"repos_count\":0,\"organization\":{\"login\":\"github3py\",\"id\":1782156,\"url\":\"https://api.github.com/orgs/github3py\",\"repos_url\":\"https://api.github.com/orgs/github3py/repos\",\"events_url\":\"https://api.github.com/orgs/github3py/events\",\"hooks_url\":\"https://api.github.com/orgs/github3py/hooks\",\"issues_url\":\"https://api.github.com/orgs/github3py/issues\",\"members_url\":\"https://api.github.com/orgs/github3py/members{/member}\",\"public_members_url\":\"https://api.github.com/orgs/github3py/public_members{/member}\",\"avatar_url\":\"https://avatars0.githubusercontent.com/u/1782156?v=4\",\"description\":\"\",\"name\":\"github3.py\",\"company\":\"github3.io\",\"blog\":\"\",\"location\":\"Madison, WI\",\"email\":\"\",\"has_organization_projects\":true,\"has_repository_projects\":true,\"public_repos\":8,\"public_gists\":0,\"followers\":0,\"following\":0,\"html_url\":\"https://github.com/github3py\",\"created_at\":\"2012-05-27T04:25:36Z\",\"updated_at\":\"2015-12-14T14:48:30Z\",\"type\":\"Organization\"}}"}, "headers": {"Date": "Sat, 16 Dec 2017 00:40:54 GMT", "Content-Type": "application/json; charset=utf-8", "Content-Length": "1319", "Server": "GitHub.com", "Status": "201 Created", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4937", "X-RateLimit-Reset": "1513386481", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "ETag": "\"cb98c1b26e3c89bf56fdb26aa0790456\"", "X-OAuth-Scopes": "admin:org, delete_repo, repo", "X-Accepted-OAuth-Scopes": "admin:org, repo", "Location": "https://api.github.com/teams/2589002", "X-GitHub-Media-Type": "github.v3; param=full; format=json", "Access-Control-Expose-Headers": "ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", "Access-Control-Allow-Origin": "*", "Content-Security-Policy": "default-src 'none'", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", "X-Content-Type-Options": "nosniff", "X-Frame-Options": "deny", "X-XSS-Protection": "1; mode=block", "X-Runtime-rack": "0.123441", "X-GitHub-Request-Id": "FEEA:266E1:3F35564:4B2B5C7:5A346B96"}, "status": {"code": 201, "message": "Created"}, "url": "https://api.github.com/orgs/github3py/teams"}, "recorded_at": "2017-12-16T00:40:54"}, {"request": {"body": {"encoding": "utf-8", "string": ""}, "headers": {"User-Agent": "github3.py/1.0.0a4", "Accept-Encoding": "gzip, deflate", "Accept": "application/vnd.github.v3.full+json", "Connection": "keep-alive", "Accept-Charset": "utf-8", "Content-Type": "application/json", "Authorization": "token <AUTH_TOKEN>", "Content-Length": "0"}, "method": "DELETE", "uri": "https://api.github.com/teams/2589002"}, "response": {"body": {"encoding": null, "string": ""}, "headers": {"Date": "Sat, 16 Dec 2017 00:40:54 GMT", "Content-Type": "application/octet-stream", "Server": "GitHub.com", "Status": "204 No Content", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4936", "X-RateLimit-Reset": "1513386481", "X-OAuth-Scopes": "admin:org, delete_repo, repo", "X-Accepted-OAuth-Scopes": "admin:org, repo", "X-GitHub-Media-Type": "github.v3; param=full; format=json", "Access-Control-Expose-Headers": "ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", "Access-Control-Allow-Origin": "*", "Content-Security-Policy": "default-src 'none'", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", "X-Content-Type-Options": "nosniff", "X-Frame-Options": "deny", "X-XSS-Protection": "1; mode=block", "X-Runtime-rack": "0.062099", "Vary": "Accept-Encoding", "X-GitHub-Request-Id": "FEEA:266E1:3F3557D:4B2B5EB:5A346B96"}, "status": {"code": 204, "message": "No Content"}, "url": "https://api.github.com/teams/2589002"}, "recorded_at": "2017-12-16T00:40:54"}], "recorded_with": "betamax/0.8.0"}
1+
{"http_interactions": [{"request": {"body": {"encoding": "utf-8", "string": ""}, "headers": {"User-Agent": "github3.py/1.0.0a4", "Accept-Encoding": "gzip, deflate", "Accept": "application/vnd.github.v3.full+json", "Connection": "keep-alive", "Accept-Charset": "utf-8", "Content-Type": "application/json", "Authorization": "token <AUTH_TOKEN>"}, "method": "GET", "uri": "https://api.github.com/orgs/github3py"}, "response": {"body": {"encoding": "utf-8", "base64_string": "H4sIAAAAAAAAA51Ty66bMBD9lYp1wiuQB1LVbruourlSpW7QAAbcazyWbXKVRvn3jjFpuDcrurPHc+ZxzvE1ENhxGRRBx20/Vjt1CTYBb4IiORzTJN9vglELeu6tVaaIIlA89KlhjUOEujPREqqZQlOuwEQTgpqyM5N2HdRDCNsjvq6DTgi3qjEjWwf1EMIObKiYXgeeMdfIH25URo2V4HX5P9XeQ5dF4QwW9EchpqCJZwVHw3SN0hLvk5hjNIv+5fw5o8EaZmrNleXoDEIBCQN7WCWcvEJABfKyCHOkcEW+8iCBNcwlvkPDDcrNp5/fKIUNwJ216NiDKclKIPmfKbdUGn+z2pqgsHpkPmEyCreoL0/PMw/eSsXxH6cdN65GvAlaFALfSK3FjUsakd56O4gPTC0svnR3rRlY1pRgae40TtJtnG/Tw0ucFWle7Pa/aJdRNe9y8i2lJdlLkhXZsdjFLsdelCPyx2JlF0ULgnbjJBMr52VoPnyT1PM5fo88tiR6X8vRQEfVd04bIaBCDUSaX7ziQtDa5Z37TofQtiE4A4hw4DLs8Py1c8o4S9BQSgCpf71r32rGKGoU1NTjdNjn+zQ7nSjvaeyWetHchiij5jmB/Cm+OWu1MArrl5w1ZXqgr+XNJlG6Nvc/UYMsPfcPBGezO25/AeqFW1bFBAAA", "string": ""}, "headers": {"Date": "Sat, 16 Dec 2017 00:40:54 GMT", "Content-Type": "application/json; charset=utf-8", "Transfer-Encoding": "chunked", "Server": "GitHub.com", "Status": "200 OK", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4938", "X-RateLimit-Reset": "1513386481", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "ETag": "W/\"e2920ca56906d85fe22cd319143a421c\"", "Last-Modified": "Mon, 14 Dec 2015 14:48:30 GMT", "X-OAuth-Scopes": "admin:org, delete_repo, repo", "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", "X-GitHub-Media-Type": "github.v3; param=full; format=json", "Access-Control-Expose-Headers": "ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", "Access-Control-Allow-Origin": "*", "Content-Security-Policy": "default-src 'none'", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", "X-Content-Type-Options": "nosniff", "X-Frame-Options": "deny", "X-XSS-Protection": "1; mode=block", "X-Runtime-rack": "0.052747", "Content-Encoding": "gzip", "X-GitHub-Request-Id": "FEEA:266E1:3F3554A:4B2B5AC:5A346B96"}, "status": {"code": 200, "message": "OK"}, "url": "https://api.github.com/orgs/github3py"}, "recorded_at": "2017-12-16T00:40:54"}, {"request": {"body": {"encoding": "utf-8", "string": "{\"name\": \"temp-team\", \"repo_names\": [], \"permission\": \"pull\", \"privacy\": \"secret\"}"}, "headers": {"User-Agent": "github3.py/1.0.0a4", "Accept-Encoding": "gzip, deflate", "Accept": "application/vnd.github.v3.full+json", "Connection": "keep-alive", "Accept-Charset": "utf-8", "Content-Type": "application/json", "Authorization": "token <AUTH_TOKEN>", "Content-Length": "82"}, "method": "POST", "uri": "https://api.github.com/orgs/github3py/teams"}, "response": {"body": {"encoding": "utf-8", "string": "{\"name\":\"temp-team\",\"id\":2589002,\"slug\":\"temp-team\",\"description\":null,\"privacy\":\"secret\",\"url\":\"https://api.github.com/teams/2589002\",\"members_url\":\"https://api.github.com/teams/2589002/members{/member}\",\"repositories_url\":\"https://api.github.com/teams/2589002/repos\",\"permission\":\"pull\",\"created_at\":\"2017-12-16T00:40:54Z\",\"updated_at\":\"2017-12-16T00:40:54Z\",\"members_count\":0,\"repos_count\":0,\"organization\":{\"login\":\"github3py\",\"id\":1782156,\"url\":\"https://api.github.com/orgs/github3py\",\"repos_url\":\"https://api.github.com/orgs/github3py/repos\",\"events_url\":\"https://api.github.com/orgs/github3py/events\",\"hooks_url\":\"https://api.github.com/orgs/github3py/hooks\",\"issues_url\":\"https://api.github.com/orgs/github3py/issues\",\"members_url\":\"https://api.github.com/orgs/github3py/members{/member}\",\"public_members_url\":\"https://api.github.com/orgs/github3py/public_members{/member}\",\"avatar_url\":\"https://avatars0.githubusercontent.com/u/1782156?v=4\",\"description\":\"\",\"name\":\"github3.py\",\"company\":\"github3.io\",\"blog\":\"\",\"location\":\"Madison, WI\",\"email\":\"\",\"has_organization_projects\":true,\"has_repository_projects\":true,\"public_repos\":8,\"public_gists\":0,\"followers\":0,\"following\":0,\"html_url\":\"https://github.com/github3py\",\"created_at\":\"2012-05-27T04:25:36Z\",\"updated_at\":\"2015-12-14T14:48:30Z\",\"type\":\"Organization\"}}"}, "headers": {"Date": "Sat, 16 Dec 2017 00:40:54 GMT", "Content-Type": "application/json; charset=utf-8", "Content-Length": "1319", "Server": "GitHub.com", "Status": "201 Created", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4937", "X-RateLimit-Reset": "1513386481", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "ETag": "\"cb98c1b26e3c89bf56fdb26aa0790456\"", "X-OAuth-Scopes": "admin:org, delete_repo, repo", "X-Accepted-OAuth-Scopes": "admin:org, repo", "Location": "https://api.github.com/teams/2589002", "X-GitHub-Media-Type": "github.v3; param=full; format=json", "Access-Control-Expose-Headers": "ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", "Access-Control-Allow-Origin": "*", "Content-Security-Policy": "default-src 'none'", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", "X-Content-Type-Options": "nosniff", "X-Frame-Options": "deny", "X-XSS-Protection": "1; mode=block", "X-Runtime-rack": "0.123441", "X-GitHub-Request-Id": "FEEA:266E1:3F35564:4B2B5C7:5A346B96"}, "status": {"code": 201, "message": "Created"}, "url": "https://api.github.com/orgs/github3py/teams"}, "recorded_at": "2017-12-16T00:40:54"}, {"request": {"body": {"encoding": "utf-8", "string": ""}, "headers": {"User-Agent": "github3.py/1.0.0a4", "Accept-Encoding": "gzip, deflate", "Accept": "application/vnd.github.v3.full+json", "Connection": "keep-alive", "Accept-Charset": "utf-8", "Content-Type": "application/json", "Authorization": "token <AUTH_TOKEN>", "Content-Length": "0"}, "method": "DELETE", "uri": "https://api.github.com/teams/2589002"}, "response": {"body": {"encoding": null, "string": ""}, "headers": {"Date": "Sat, 16 Dec 2017 00:40:54 GMT", "Content-Type": "application/octet-stream", "Server": "GitHub.com", "Status": "204 No Content", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4936", "X-RateLimit-Reset": "1513386481", "X-OAuth-Scopes": "admin:org, delete_repo, repo", "X-Accepted-OAuth-Scopes": "admin:org, repo", "X-GitHub-Media-Type": "github.v3; param=full; format=json", "Access-Control-Expose-Headers": "ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", "Access-Control-Allow-Origin": "*", "Content-Security-Policy": "default-src 'none'", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", "X-Content-Type-Options": "nosniff", "X-Frame-Options": "deny", "X-XSS-Protection": "1; mode=block", "X-Runtime-rack": "0.062099", "Vary": "Accept-Encoding", "X-GitHub-Request-Id": "FEEA:266E1:3F3557D:4B2B5EB:5A346B96"}, "status": {"code": 204, "message": "No Content"}, "url": "https://api.github.com/teams/2589002"}, "recorded_at": "2017-12-16T00:40:54"} ], "recorded_with": "betamax/0.8.0"}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp