demonstrates : - ls - docs - docs.open - groups - parameters - parameters.get_value - curves - curves.get_data - curves.breakpoints """ if __name__ == '__main__': indent = connect('127.0.0.1', indentation_port) result = indent.ls() print 'Connected to %(server_name)s, V%(server_version)s' % result result = indent.docs.open(path='C:\\ProgramData\\Anton Paar\\Indentation\\Sample\\Demo.MIT') doc_id=result['doc_id'] docs = indent.docs() print docs doc_name= docs['docs'][doc_id]['name'] print 'Opened', doc_name groups = indent.groups(doc_id=doc_id) parameters = indent.parameters(doc_id=doc_id)
def test_encryption(self): client = connect('localhost', 8001, config.secret) result = client.sum(49, 51) self.assertTrue(result == 100)
from jsonrpctcp import connect, config, history from jsonrpctcp.server import Server from jsonrpctcp import logger from jsonrpctcp.errors import ProtocolError, EncryptionMissing import unittest import os import time try: import json except ImportError: import simplejson as json from threading import Thread import signal import logging CLIENT = connect('127.0.0.1', 8000) class TestCompatibility(unittest.TestCase): def setUp(self): pass # Version 2.0 Tests def test_positional(self): """ Positional arguments in a single call """ result = CLIENT.subtract(23, 42) self.assertTrue(result == -19) result = CLIENT.subtract(42, 23) self.assertTrue(result == 19) request = json.loads(history.request)
result = conn.bodyInfo(bodyId) decoded = json.loads(result) return str(decoded["result"][0]["room"]) # return if someone is in roomId def roomEmpty(conn, roomId): result = conn.bodyInfo() decoded = json.loads(result) for body in decoded["result"]: if body["room"] == roomId: return False return True conn = connect('localhost', 44123) # UpdateDateTime [hourOfDay] [hourOfDay] [min] [sec] [dayOfMonth] [month] [year] # Updates the time to 20:00:00, e.i., the scenario is at night, it gets dark result = conn.UpdateDateTime("20") print result # Get information of all bodies in the simulation decoded = json.loads(conn.bodyInfo()) bodies = decoded["result"] # Initial rooms where bodies are located rooms = [] for i in range(len(bodies)): print "index: " + str(i) room = bodies[i]["room"]