Events service

This service exposes the Events API. Much of this API is read-only, and while pagination is supported, there is a fixed page size of 30 with a limit of 10 page requests.

Many events have an actor which denotes the user that performed an event. Additionally, there may be org or repo attributes for events related to Organizations and Repos. Finally, each event object contains a payload attribute containing more detailed information about the event.

Public Events

Yields the most recent public events from Github.

from pygithub3 import Github

gh = Github()

events = gh.events.list().all()
print events[0].payload

Event

class pygithub3.services.events.Event(**config)

Consume Events API

The events API supports pagination, but with a fixed page size of 30; In addition, fetching up to ten pages is supported, for a total of 300 events.

issues

Issues events

networks

Network

orgs

Org

repos

Repo

users

User

list()

List all public events.

Returns:A Result

Note

Hits the API fetching maximum number of events (300 = 30/page * 10)

Repo Events

These are events for a specific repo, including issue and network events. The Issues events are proxied to the Issues services.

events = gh.events.repos.list(user="copitux", repo="python-github3")
for e in events.next():
    print("{t}".format(t=e.type))

# Get the issue Events
events = gh.events.issues.list_by_repo(user="copitux",
                                       repo="python-github3")

# Get the Public Events for a Repo's Network
events = gh.events.networks.list(user="copitux", repo="python-github3")

Network

class pygithub3.services.events.networks.Network(**config)

Consume a Repo’s public Network Events API

list(user=None, repo=None)

List the events for a repository’s Network

Parameters:
  • user (str) – Username
  • repo (str) – Repository
Returns:

A Result

Note

Remember Config precedence

Repo

class pygithub3.services.events.repos.Repo(**config)

Consume Repo Events API

list(user=None, repo=None)

Get repository’s events

Parameters:
  • user (str) – Username
  • repo (str) – Repository
Returns:

A Result

Note

Remember Config precedence

Note

Remember that the Events API give 10 pages with 30 entries, up to 300 events, so you’ll only get the last 300 Repo events

Organization Events

These are the public events for an Organization

events = gh.events.orgs.list(org="Acme")

You may also get a user’s feed of events for an Organization, but you must be authenticated as the provided user, and you must be a member of the given organization.

events = gh.events.users.orgs(user="copitux", org="acme")

Org

class pygithub3.services.events.orgs.Org(**config)

Consume a Org Events API

list(org=None)

List the events for an Organization

Parameters:org (str) – Organization name
Returns:A Result

User Events

You can retrieve the public events performed by a user and the public events that a user receives. If you’re authenticated, you may also receive private events.

received_events = gh.events.users.list_received_public(user="copitux")
performed_events = gh.events.users.list_performed_public(user="copitux")

If authenticated as copitux, you could get private events with the following, otherwise you’ll just get the public events as above:

received_events = gh.events.users.list_received(user="copitux")
performed_events = gh.events.users.list_performed(user="copitux")

User

class pygithub3.services.events.users.User(**config)

Consume User Events API

list_performed(user=None)

List the events performed by a given user. If authenticated as the given user, you’ll see private events as well as public events.

Parameters:user (str) – Username
Returns:A Result

Note

Remember Config precedence

list_performed_public(user=None)

List only the public events performed by the given user.

Parameters:user (str) – Username
Returns:A Result

Note

Remember Config precedence

list_received(user=None)

List the events received by a given user. If authenticated as the given user, you’ll see private events as well as public events.

Parameters:user (str) – Username
Returns:A Result

Note

Remember Config precedence

list_received_public(user=None)

List only the public events received by the given user.

Parameters:user (str) – Username
Returns:A Result

Note

Remember Config precedence

orgs(user=None, org=None)

List the events for the User’s organization dashboard.

Parameters:user (str) – Username
Returns:A Result

Warning

You must be authenticated as the given user.

Note

Remember Config precedence