now excel is working

This commit is contained in:
2021-04-17 20:49:08 +03:00
parent d4ba19bf41
commit e1f43772b9
3 changed files with 54 additions and 26 deletions

11
main.py
View File

@@ -78,12 +78,19 @@ if __name__ == '__main__':
help='The name of the requested chain',
choices=chain_dict.keys(),
)
parser.add_argument('--type',
choices=("excel", "csv"),
default='excel',
help="a switch flag to set set the output file to a CSV file",
required=False,
)
args = parser.parse_args()
file_type = '.xlsx' if not args.type or args.type == 'excel' else '.csv'
chain: SupermarketChain = chain_dict[args.chain]
if args.promos:
arg_store_id = int(args.promos[0])
main_latest_promos(store_id=arg_store_id, load_xml=args.load_prices, chain=chain, load_promos=args.load_promos)
main_latest_promos(store_id=arg_store_id, load_xml=args.load_prices, chain=chain, load_promos=args.load_promos, file_type=file_type)
elif args.price:
get_products_prices(chain, store_id=args.price[0], load_xml=args.load_prices, product_name=args.price[1])