diff --git a/export_stars/export_stars.py b/export_stars/export_stars.py index 6a93a32..7631dee 100755 --- a/export_stars/export_stars.py +++ b/export_stars/export_stars.py @@ -28,16 +28,14 @@ def config_retry(backoff_factor=1.0, total=8): return Retry(total=total, backoff_factor=backoff_factor) -def parse_args(): - parser = ArgumentParser(description="export a GitHub user's starred repositorys to CSV") - parser.add_argument("--user") - parser.add_argument("--github-token") - return parser.parse_args() - - def main(): - args = parse_args() + parser = ArgumentParser(description="export a GitHub user's starred repositories to CSV") + parser.add_argument("--user", dest='user') + parser.add_argument("--github-token", dest='token') + args = parser.parse_args() if not args.user: + parser.print_usage() + print('') print("Please set `--user` to a valid GitHub user name.", file=sys.stderr) exit(1) diff --git a/readme.md b/readme.md index 110f72c..701dd2e 100644 --- a/readme.md +++ b/readme.md @@ -1,5 +1,19 @@ This script exports a GitHub user's starred repositories (URL & description) to a CSV file. -Usage: `GH_USER=defunkt python3 export_stars.py > stars.csv` +Setup: + + python -m pip install -r requirements.txt + pip install -r requirements.txt + +Usage: + +NOTE1 Under Microsoft Windows may need to set: + + set PYTHONUTF8=1 + +NOTE2 Can use without a token BUT if there are a lot of stars need a token to avoid `github.GithubException.RateLimitExceededException` + + GH_USER=defunkt python3 export_stars/export_stars.py > stars.csv + python export_stars/export_stars.py --user defunkt > stars.csv Thanks to the authors of [PyGitHub](https://github.com/PyGithub/PyGithub) for the slick client library.