revbank-inflatinator/inflatinator/__main__.py

23 lines
532 B
Python

import logging
import os
import revbank
import sys
def main(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)
if __name__ == '__main__':
main(sys.argv[1])