def process(): CONN = Postgres(DB_SETTINGS['host'], DB_SETTINGS['port'], DB_SETTINGS['username'], DB_SETTINGS['password'], DB_SETTINGS['db_name'], DB_SETTINGS['timeout']) DELIVERIES = Deliveries(CONN) ORDERS = DELIVERIES.get_unsynced_deliveries() if not ORDERS: return True print len(ORDERS) print "Are orders more than %s" % sys.argv[1] if len(ORDERS) > (int(sys.argv[1]) or 400): DELIVERIES.sms_results(len(ORDERS))
from lib.Orders import Orders, DB_SETTINGS from lib.Postgres import Postgres import os if __name__ == "__main__": CONN = Postgres(DB_SETTINGS['host'], DB_SETTINGS['port'], DB_SETTINGS['username'], DB_SETTINGS['password'], DB_SETTINGS['db_name'], DB_SETTINGS['timeout']) Orders = Orders(CONN) ORDERS = Orders.get_new_agent_orders('sale') PRODUCT = Orders.get_high_value_product('sale') Orders.format_xlsx(ORDERS, PRODUCT, 'confirmed_high_value_orders.xlsx') Orders.email_results('confirmed_high_value_orders.xlsx') os.remove('confirmed_high_value_orders.xlsx')