diff --git a/python-pygithub/example.py b/python-pygithub/example.py index 8a9c8fa..ec49752 100755 --- a/python-pygithub/example.py +++ b/python-pygithub/example.py @@ -1,9 +1,16 @@ +import argparse import lib from datetime import datetime from time import sleep from yaml import load, SafeLoader if __name__ == '__main__': + parser = argparse.ArgumentParser() + parser.add_argument( + "--sleep", type=int, default=60 * 5, help="Number of seconds between requests" + ) + args = parser.parse_args() + with open('.config.yml') as config_file: config = load(config_file, Loader=SafeLoader) for meta in config.get('orgs', list()): @@ -13,5 +20,5 @@ while True: print(f"- TIMESTAMP: {datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S')}") print(f"- REPO OBJECT: {ghapi.org_repos()[0].full_name}\n") - sleep(5) + sleep(args.sleep) print('done') \ No newline at end of file