def register_swipe(self, card_uid, time): if not self.offline: try: bark_api.post_swipe(self.auth_token, self.device_id, self.event_id, time.isoformat(), card_uid) except: pass self.session_swipes.append({'card_uid':card_uid, 'timestamp':time})
def handle_swipe(reader, auth_token, device_id, event_id): swipe = reader.read() timestamp = datetime.datetime.now().isoformat() print swipe zid = raw_input("Cardholder Z-id:") print "Looking up details of " + zid user = ldap.get_user(zid) print user['displayName'] print user['school'] print user['faculty'] enrol = raw_input("Add cardholder to society and upload swipe? [y/n]") if enrol == 'y': api.post_swipe(auth_token, device_id, event_id, timestamp, swipe) api.create_identity(auth_token, swipe, zid)