def run(self): client = pysip2.client.Client(server, int(port)) client.default_institution = institution client.connect() client.login(username, password, location_code) for i in range(10): resp = client.patron_info_request(self.barcode) time.sleep(.02) client.disconnect() client.log_messages()
''' logging.config.fileConfig('pysip2-client.ini') config = configparser.ConfigParser() config.read('pysip2-client.ini') copy_barcode = sys.argv[1] server = config['client']['server'] port = config['client']['port'] institution = config['client']['institution'] username = config['client']['username'] password = config['client']['password'] location_code = config['client']['location_code'] client = pysip2.client.Client(server, int(port)) client.default_institution = institution client.connect() client.login(username, password, location_code) resp = client.checkin_request(copy_barcode, location_code) if resp.get_fixed_field_by_name('ok').value == '1': print(" * Checkin Succeeded") else: print(" * Checkin Failed") print("Full Checkin Response:\n" + repr(resp)) client.disconnect()
PYTHONPATH=../src/ ./item-info-request.py <copy_barcode> ''' logging.config.fileConfig('pysip2-client.ini') config = configparser.ConfigParser() config.read('pysip2-client.ini') server = config['client']['server'] port = config['client']['port'] institution = config['client']['institution'] username = config['client']['username'] password = config['client']['password'] location_code = config['client']['location_code'] copy_barcode = sys.argv[1] client = pysip2.client.Client(server, int(port)) client.default_institution = institution client.connect() client.login(username, password, location_code) resp = client.item_info_request(copy_barcode) print("All Fields:\n" + repr(resp)) # example of accessing a field by code print("title: %s\n" % resp.get_field_by_code('AJ').value) client.disconnect() client.log_messages()