Created
April 18, 2020 17:21
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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