create_new_stock.py 470 B

1234567891011121314
  1. from datetime import timedelta
  2. from time import strptime
  3. import model
  4. from model import cleanup
  5. if __name__ == '__main__':
  6. timeout = float(input('How long will the initial selling be available? (minutes):'))
  7. try:
  8. expiry = strptime(model.current_db_time(), '%Y-%m-%d %H:%M:%S') + timedelta(minutes=timeout)
  9. print(model.new_stock(expiry))
  10. cleanup()
  11. except OverflowError:
  12. print('The expiration time is too far in the future.')