GitStats
This is the first release of GitStats.
Usage
In this release, you can grab generic data about a user using GitStats.user_info()
Here is an example:
from pygitstats.graphql import GitStats
import os
g = GitStats(os.environ['GITHUB_PERSONAL_ACCESS_TOKEN']) # Don't store your Personal Access Token in plain text!
user_info = g.user_info('DillonB07') # User to get info on
print(user_info)
You can also use custom GraphQL queries like so:
from pygitstats.graphql import GitStats
import os
username = 'DillonB07'
query = '''
query repo_count {
user(login: "''' + username + '''") {
repositories {
totalCount
}
}
}
'''
g = GitStats(os.environ['GITHUB_PERSONAL_ACCESS_TOKEN']) # Don't store your Personal Access Token in plain text!
total_repos = g.custom_query(query) # Custom query will return the amount of repositories the user has
print(total_repos)
Remember: DO NOT STORE YOUR PERSONAL ACCESS TOKEN IN YOUR PROGRAM! 0adfd2d
Installation
This package can be installed from PyPi via one of the following commands:
Pip
pip install pygitstats
pip3 install pygitstats
python -m pip install pygitstats
python3 -m pip install pygitstats
Poetry
poetry install pygitstats
Conda
conda install pygitstats
Pipenv
pipenv install pygitstats
Credit
Feedback and suggestions for the package would be appreciated!
Credit to @JBYT27 for GitAPI which inspired this project. I've also taken(and modified) some code from that repo.
Source code(tar.gz)
Source code(zip)