def setStudentPresent(self): self.start() # Creation client com avec Serveur NFC print('thread start') client = Client(config.URI) try: lastID = "" while self.run: cardmonitor = CardMonitor() cardobserver = ComUsb() cardmonitor.addObserver(cardobserver) time.sleep(1) tmp = cardobserver.repUid print(tmp) if tmp != "" and tmp != lastID: lastID = tmp data = client.get('/1.0/user/byTag/' + tmp) self.cours[self.idCour].setPresent(self.reseau, data["login"], "present") self.gui.setStatus(data["login"], "present") cardmonitor.deleteObserver(cardobserver) except Exception as e: print(str(e)) self.finished.emit()
class TestCase(unittest.TestCase): def setUp(self): self.client = Client(API_KEY) new_selection = self.client.create_selection(SAMPLE_SELECTION) self.selection_id = new_selection['Id'] def tearDown(self): self.client.delete_selection(self.selection_id)
def setUp(self): self.client = Client()
if __name__ == "__main__": reseau = Reseau() planning = Planning() reseau.authenticate("*****@*****.**", "hjR5HQq.") cours = planning.reqDay(reseau) # Attente selection du cours !!!! id_cour = input('Selection du cours: ') cours[int(id_cour)].reqRegistered(reseau) # Creation client com avec Serveur NFC client = Client(config.URI) print('Place card') lastID = "" try: while True: cardmonitor = CardMonitor() cardobserver = ComUsb() cardmonitor.addObserver(cardobserver) time.sleep(1) tmp = cardobserver.repUid if tmp != "" and tmp != lastID: lastID = tmp data = client.get('/1.0/user/byTag/' + tmp) cours[int(id_cour)].setPresent(reseau, data["login"],
len(child_node['Children']) if 'Children' in child_node else 'NA')) return indicator_tree # takes a list of possible commands in the form of a dictionary with # fields for (at least) name and prints each one def print_command_list(command_options): print("\n--Options--") for i in range(len(command_options)): print("{0}. {1}".format(i, command_options[i]['name'])) if __name__ == '__main__': # baseline functinoality demo client = Client() API_KEY = client.api_key # initialize new selection for purposes of this demo print('Creating new selection...') new_selection = client.create_selection(sample_selection) SELECTION_ID = new_selection['Id'] print('New selection created with id: {}'.format(SELECTION_ID)) command_options = [ { "name": "Quit" }, { "name": "Log in", "function": login_test, "arguments": [client] }, { "name": "Download selection", "function": download_test,
def setUp(self): self.client = Client(API_KEY) new_selection = self.client.create_selection(SAMPLE_SELECTION) self.selection_id = new_selection['Id']
def setUp(self): self.client = Client(API_KEY)
from api_client import Client, UnauthorizedException client = Client('your_token') try: response = client.get_company('example.com') print(response) except UnauthorizedException as e: print('UnauthorizedException') print(e)