Python argparse - pass file without using command line
I want to pass file using form-data to the argparse. But i'm not getting how to pass file to the argparse without using command-line. I also gone through the [https://stackoverflow.com/questions/31090479/python-argparse-pass-values-without-command-line] this solution but this is not helpful for me.
I want to pass file using form-data.
this is my code:
def get_parser():
parser = argparse.ArgumentParser(
description='Capital gains calculator')
parser.add_argument('infile', nargs='?',
type=argparse.FileType('r'),
default=sys.stdin)`
can anyone help?
Thanks