Skip to content

Instantly share code, notes, and snippets.

@osharaki
Last active May 3, 2021 16:51
Show Gist options
  • Save osharaki/47a2c33da3144018fc36b682331b414c to your computer and use it in GitHub Desktop.
Save osharaki/47a2c33da3144018fc36b682331b414c to your computer and use it in GitHub Desktop.
Unogs API miner: CLI arguments (snippet 6/6)
def init_cli(default_buffer, default_time):
parser = argparse.ArgumentParser()
parser.add_argument(
"-b",
dest="buffer",
type=buffer_type,
default=default_buffer,
metavar="[0-100]",
help=f"The number of requests [{0}-{100}] from the daily quota to leave remaining (i.e. unconsumed). Defaults to {default_buffer}",
)
parser.add_argument(
"-t",
dest="exec_time",
type=time_type,
default=default_time,
metavar="now|HH:mm",
help="When to start making API requests. Accepts either now (for immediate execution) or HH:mm (i.e. hours followed by minutes in the 24-hour time format). Defaults to 21:35 machine time.",
)
parser.add_argument(
"-o",
dest="offset",
type=offset_type,
default=0,
metavar="Non-negative multiple of 100, e.g. 0, 100, 200, etc.",
help="Where to start retrieving results. For example, an offset of 200 will yield results starting at the show with index 200 (i.e. the third 100 results). Defaults to 0.",
)
return parser.parse_args()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment