I have been given a Python application and I need to make it into an Azure Function and within its main function we have this argparse
configuration:
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Prepare documents by extracting content from PDFs, splitting content into sections, uploading to blob storage, and indexing in a search index.",
epilog="Example: prepdocs.py "'..\data\*'" --storageaccount myaccount --container mycontainer --searchservice mysearch --index myindex -v",
)
parser.add_argument("files", nargs="?", help="Files to be processed")
parser.add_argument(
"--datalakestorageaccount", required=False, help="Optional. Azure Data Lake Storage Gen2 Account name"
)
I want to be able to execute this main method with the parameters required. For example:
--verbose --subscriptionid $AZURE_SUBSCRIPTION_ID
and I want to be able to execute this script from my main Azure function Python code. How can I do this? I don’t want to use os.system
for example because this would not be good in an Azure function.
Is this possible?
5