create_new_stock.py 443 B

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