Orgs services¶
Fast sample:
from pygithub3 import Github
gh = Github(token='abc123')
auth_orgs = gh.orgs.list().all()
members = gh.orgs.members.list('github')
Org¶
-
class
pygithub3.services.orgs.
Org
(**config)¶ Consume Orgs API
-
get
(org)¶ Get a single org
Parameters: org (str) – Org name
-
list
(user=None)¶ Get user’s orgs
Parameters: user (str) – Username Returns: A Result If you call it without user and you are authenticated, get the authenticated user’s orgs, public and private.
If you call it with a user, get the user’s public orgs.
org_service.list('copitux') org_service.list()
-
update
(org, data)¶ Update a single org
Parameters: - org (str) – Org name
- data (dict) – Input. See github orgs doc
Warning
You must be authenticated
org_service.update(dict(company='ACME Development', location='Timbuctoo'))
-
Members¶
-
class
pygithub3.services.orgs.members.
Members
(**config)¶ Consume Members API
-
conceal_membership
(org, user)¶ Conceal user’s membership in org
Parameters: - org (str) – Organisation name
- user (str) – User name
Warning
You must be authenticated and the user, or an owner of the org
-
is_member
(org, user)¶ Determine if user is a member of org
Parameters: - org (str) – Organisation name
- user (str) – User name
-
is_public_member
(org, user)¶ Determine if user is a public member of org
Parameters: - org (str) – Organisation name
- user (str) – User name
-
list
(org)¶ Get org’s members
Parameters: org (str) – Organisation name Returns: A Result If you call it authenticated, and are a member of the org, public and private members will be visible.
If not, only public members will be visible.
-
list_public
(org)¶ Get org’s public members
Parameters: org (str) – Organisation name Returns: A Result
-
publicize_membership
(org, user)¶ Publicize user’s membership in org
Parameters: - org (str) – Organisation name
- user (str) – User name
Warning
You must be authenticated and the user, or an owner of the org
-
remove_member
(org, user)¶ Remove user from all teams in org
Parameters: - org (str) – Organisation name
- user (str) – User name
Warning
You must be authenticated and an owner of org
-
Teams¶
-
class
pygithub3.services.orgs.teams.
Teams
(**config)¶ Consume Teams API
Warning
You must be authenticated as an owner of the org
-
add_member
(id, user)¶ Add a user to a team
Parameters: - id (int) – The team id
- user (str) – User name
-
add_repo
(id, user, repo)¶ Give team members access to a repo
Parameters: - id (int) – The team id
- user (str) – User name
- repo (str) – Repo name
-
contains_repo
(id, user, repo)¶ Determine if user is a member of a team
Parameters: - id (int) – The team id
- user (str) – User name
- repo (str) – Repo name
-
create
(org, data)¶ Create a new team
Parameters: - org (str) – Organisation name
- data (dict) – Input. See github orgs teams doc
-
delete
(id)¶ Delete a team
Parameters: id (int) – The team id
-
is_member
(id, user)¶ Determine if user is a member of a team
Parameters: - id (int) – The team id
- user (str) – User name
-
list_repos
(id)¶ List the repos that a team’s members get access to
Parameters: id (int) – The team id Returns: A Result
-
remove_member
(id, user)¶ Remove a member from a team
Parameters: - id (int) – The team id
- user (str) – User name
-
remove_repo
(id, user, repo)¶ Remove a repo from the a team
Parameters: - id (int) – The team id
- user (str) – User name
- repo (str) – Repo name
-
update
(id, data)¶ Update a team
Parameters: - id (int) – The team id
- data (dict) – Input. See github orgs teams doc
-