Users

Note

See the official GitHub API v2 documentation for users.

class github2.users.User(type)[source]

GitHub user container.

public_repo_count

Number of active repositories owned by the user

plan

Current active github plan

total_private_repo_count

Number of private repositories

company

Name of the company the user is associated with

following_count

Number of other users the user is following

name

The users full name

followers_count

Number of users following this user

login

The login username

disk_usage

Currently used disk space

public_gist_count

Number of active public gists owned by the user

id

The user id

created_at

The date this user was registered

email

The users e-mail address

owned_private_repo_count

Number of privately owned repos

private_gist_count

Number of private gists owned by the user

location

Location of the user

collaborators

Number of collaborators

blog

The users blog

is_authenticated()[source]

Test for user authentication.

Return bool:True if user is authenticated
class github2.users.Users(type)[source]

GitHub API user functionality.

add_key(key, title='')[source]

Add a SSH key for the authenticated user.

param str key:SSH key identifier
param str title:
 Optional title for the SSH key

Warning

Requires authentication

follow(other_user)[source]

Follow a GitHub user.

param str other_user:
 GitHub user name

Warning

Requires authentication

followers(username)[source]

Get list of GitHub user’s followers.

Parameters:username (str) – GitHub user name
following(username)[source]

Get list of users a GitHub user is following.

Parameters:username (str) – GitHub user name
list_keys()[source]

Get list of SSH keys for the authenticated user. .. warning:: Requires authentication

remove_key(key_id)[source]

Remove a SSH key for the authenticated user.

param int key_id:
 SSH key’s GitHub identifier

Warning

Requires authentication

search(query)[source]

Search for users.

Parameters:query (str) – term to search for
search_by_email(query)[source]

Search for users by email address.

Parameters:query (str) – email to search for
show(username)[source]

Get information on GitHub user.

if username is None or an empty string information for the currently authenticated user is returned.

Note

This call is enhanced with authentication

unfollow(other_user)[source]

Unfollow a GitHub user.

param str other_user:
 GitHub user name

Warning

Requires authentication

class github2.users.Key(type)[source]

SSH key container.

key

The SSH key data

title

The title for the SSH key

id

The key id

Examples

Searching

>>> results = github.users.search("foo")

Getting User Information

>>> user = github.users.show("ask")
>>> user.name
"Ask Solem"

Getting User Network

>>> github.users.followers("ask")
['greut', 'howiworkdaily', 'emanchado', 'webiest']
>>> github.users.following("ask")
['sverrejoh',
'greut',
'jezdez',
'bradleywright',
'ericflo',
'howiworkdaily',
'emanchado',
'traviscline',
'russell']

Following Network

>>> github.users.follow("jezdez")
>>> github.users.unfollow("jezdez")

Table Of Contents

Previous topic

Creating a client

Next topic

Organizations

This Page