revbank-inflatinator/inflatinator/__main__.py
polyfloyd a3b5392f7f
All checks were successful
Test / test (push) Successful in 1m6s
Use proper Python imports
2025-07-17 18:03:53 +02:00

30 lines
616 B
Python
Executable file

#!/usr/bin/env python3
import logging
import os
import sys
import inflatinator.revbank as revbank
def main_args(product_file):
log_level = os.environ.get('LOG_LEVEL', 'INFO').upper()
logging.basicConfig(level=log_level)
logging.getLogger("requests").setLevel(logging.WARNING)
logging.getLogger("urllib3").setLevel(logging.WARNING)
with open(product_file, 'r') as fd:
src = fd.read()
new_src = revbank.update_product_pricings(src)
with open(product_file, 'w') as fd:
fd.write(new_src)
def main():
main_args(sys.argv[1])
if __name__ == '__main__':
main()