From 0113cdd6cafca9d1806b519a96f7e20ba272319b Mon Sep 17 00:00:00 2001 From: Greg Pflaum Date: Sun, 31 Jan 2021 08:56:06 -0500 Subject: [PATCH] --sleep option Use same 5 minute default as the ruby example. --- python-pygithub/example.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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