Skip to content

Instantly share code, notes, and snippets.

@alexwykoff
Created April 18, 2020 17:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexwykoff/b594c10c1abf96d1dbf5296b67fb25da to your computer and use it in GitHub Desktop.
Save alexwykoff/b594c10c1abf96d1dbf5296b67fb25da to your computer and use it in GitHub Desktop.
How to use an api key in an app without sharing your own
from github import Github
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-t", "--test", help="Test Mode, do not create Github issues")
args = parser.parse_args()
secret_file = open('github.secret', 'r')
token_string = secret_file.readline().rstrip("\n\r")
g = Github(token_string, timeout=1000)
rate = g.get_rate_limit()
limit = rate.rate.limit
remaining = rate.rate.remaining
print("Rate Limit: " + str(limit))
print("Rate Remaining: " + str(remaining))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment