def __init__(self, **kwargs): """Prepare a configured instance of the API wrapper and return it. Keyword arguments are passed directly to iron_core_python; consult its documentation for a full list and possible values.""" self.client = iron_core.IronClient(name=IronWorker.NAME, version=IronWorker.VERSION, product="iron_worker", **kwargs)
def __init__(self, name=None, **kwargs): """Prepare a configured instance of the API wrapper and return it. Keyword arguments are passed directly to iron_core_python; consult its documentation for a full list and possible values.""" if name is not None: self.name = name kwargs['api_version'] = kwargs.get('api_version') or IronMQ.API_VERSION self.client = iron_core.IronClient(name=IronMQ.NAME, version=IronMQ.VERSION, product='iron_mq', **kwargs)
def test_fromArgsBareMinimum(self): client = iron_core.IronClient(name="Test", version="0.1.0", product="iron_worker", token="TEST", project_id="TEST2", api_version=2, host="worker-aws-us-east-1.iron.io") self.assertEqual(client.host, "worker-aws-us-east-1.iron.io") self.assertEqual(client.project_id, "TEST2") self.assertEqual(client.token, "TEST") self.assertEqual(client.protocol, "https") self.assertEqual(client.port, 443) self.assertEqual(client.api_version, 2) self.assertEqual(client.headers["User-Agent"], "Test (version: 0.1.0)") self.assertEqual(client.headers["Authorization"], "OAuth TEST") self.assertEqual(client.base_url, "https://worker-aws-us-east-1.iron.io/2/projects/TEST2/")