import reprlib import os import requests # payload = {'isbn': '9780062113788'} # r = requests.post('http://library.dandhost.com/lookup', data= {'isbn': '9780062113788'}) # print(r.text) URL = 'http://library.dandhost.com' # URL = 'http://127.0.0.1:8000' UserID = 1 Card = 1 Shelf = 1 Mode = 1 def processBook(ISBN): if Mode == 1: r = requests.post(URL+'/checkin/', data={'isbn': ISBN, 'locationid': Shelf, 'userid': UserID}) print(r.text) while True: var = str(input()) x = var.split('.') command = x[0] if command == 'LOC': Shelf = x[1] print('Switching shelf to shelf #' + Shelf) elif command == 'CI': Mode = 1 print('Mode Check in') elif command == 'CO': Mode = 2 print('Mode Check out') elif command == 'CARD': Card = 1 elif command == 'UPDATE': os.system('cd ~/libraryClient') os.system('git pull') elif command == '': pass else: ISBN = x[0] print(ISBN) processBook(ISBN)