def __init__(self, netPort, netBaudrate, camIp, camPort): self._online = False self._active = False self._swarm = robot.RobotNetwork(netPort, netBaudrate) self._camera = server.Client(camIp, camPort) self._markers = {} self._commandReady = False self._commandData = {}
def __init__(self, access_token, url): # Create REST server client options = ({ 'headers': { 'Authorization': 'Bearer ' + access_token }, 'user_agent': 'whetlab_python_client', 'api_version': 'api', 'base': url }) self._client = server.Client({}, options)
def testConnect(self): ''' validate that server-client connection is happening and that handler is installed correctly ''' def fakeHandler(request): if request=={'a':'b'}: return {'c':'d'} else: return 'not the right thing received' self.server.run(fakeHandler) for i in range(100): client = server.Client("127.0.0.1",self.port) result = client.send({'a':'b'}) self.assertEquals(result, {'c':'d'})
def decorated(*args,**kwargs): import server client = server.Client("127.0.0.1", 9025) sysPath = [] if not hasattr(setupModule, 'sysPath') else setupModule.sysPath print "running {0}.{1}...".format(cls.__name__,methodName) global currentTestSuite response = client.send({ 'testSuiteId': currentTestSuite, 'sysPath': sysPath, 'setupModuleName': setupModule.__name__, 'moduleName': cls.__module__, 'className': cls.__name__, 'testMethodName': methodName }) if response['result']=='exception': print response['stackTrace'] raise pickle.loads(base64.b64decode(response['exception'])) print "done executing",cls.__name__+'.'+methodName
xmax = 200 ymax = 160 xaim = 180 yaim = 140 buffer = 7 first_filling = 1000 obstacle = first_filling * 2 #x0=180 #y0=140 start_time = time.time() # Pobieranie wartości poszczególnych markerów przy działającej kamerze # do odkomentowania przy pracy z kamerą with server.Client() as c: markers = c.read(server.READ_MARKERS)["markers"] # dodanie numeru ID kodu counter = 0 for marker in markers: marker.insert(3, float(counter)) counter = counter + 1 # pobieranie wartości markerów z pliku tekstowego # do zakomentowania przy pracy z kamerą """ file = open('markers.txt', 'r').read() lines=file.replace("{'markers': [[", "") lines=lines.replace("]]}", "") lines = lines.split('], [')