How to use the boto.resultset.ResultSet function in boto

To help you get started, we’ve selected a few boto examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Dallinger / Dallinger / tests / test_mturk.py View on Github external
def test_create_hit_translates_response_back_from_mturk(self, with_mock):
        with_mock.mturk.configure_mock(**{
            'register_hit_type.return_value': fake_hit_type_response(),
            'set_rest_notification.return_value': ResultSet(),
            'create_hit.return_value': fake_hit_response(),
        })

        hit = with_mock.create_hit(**standard_hit_config())

        assert hit['max_assignments'] == 1
        assert hit['reward'] == .01
        assert hit['keywords'] == ['testkw1', 'testkw2']
        assert isinstance(hit['created'], datetime.datetime)
        assert isinstance(hit['expiration'], datetime.datetime)
github boto / boto / tests / unit / cloudformation / test_stack.py View on Github external
def test_parse_tags(self):
        rs = boto.resultset.ResultSet([
          ('member', boto.cloudformation.stack.Stack)
        ])
        h = boto.handler.XmlHandler(rs, None)
        xml.sax.parseString(SAMPLE_XML, h)
        tags = rs[0].tags
        self.assertEqual(tags, {u'key0': u'value0', u'key1': u'value1'})
github apache / mesos / third_party / boto-2.0b2 / boto / ec2 / elb / loadbalancer.py View on Github external
def startElement(self, name, attrs, connection):
        if name == 'HealthCheck':
            self.health_check = HealthCheck(self)
            return self.health_check
        elif name == 'Listeners':
            self.listeners = ResultSet([('member', Listener)])
            return self.listeners
        elif name == 'AvailabilityZones':
            return self.availability_zones
        elif name == 'Instances':
            self.instances = ResultSet([('member', InstanceInfo)])
            return self.instances
        else:
            return None
github boto / boto / boto / emr / jobflow.py View on Github external
def startElement(self, name, attrs, connection):
        if name == 'Steps':
            self.steps = ResultSet([('member', Step)])
            return self.steps
        else:
            return None
github jtriley / StarCluster / starcluster / hacks.py View on Github external
params['Name'] = name
    if description:
        params['Description'] = description
    if architecture:
        params['Architecture'] = architecture
    if kernel_id:
        params['KernelId'] = kernel_id
    if ramdisk_id:
        params['RamdiskId'] = ramdisk_id
    if image_location:
        params['ImageLocation'] = image_location
    if root_device_name:
        params['RootDeviceName'] = root_device_name
    if block_device_map:
        block_device_map.build_list_params(params)
    rs = conn.get_object('RegisterImage', params, ResultSet)
    image_id = getattr(rs, 'imageId', None)
    return image_id
github boto / boto / boto / ec2 / elb / policies.py View on Github external
def startElement(self, name, attrs, connection):
        if name == 'AppCookieStickinessPolicies':
            rs = ResultSet([('member', AppCookieStickinessPolicy)])
            self.app_cookie_stickiness_policies = rs
            return rs
        elif name == 'LBCookieStickinessPolicies':
            rs = ResultSet([('member', LBCookieStickinessPolicy)])
            self.lb_cookie_stickiness_policies = rs
            return rs
        elif name == 'OtherPolicies':
            rs = ResultSet([('member', OtherPolicy)])
            self.other_policies = rs
            return rs
github GoogleCloudPlatform / gsutil / gslib / vendored / boto / boto / s3 / connection.py View on Github external
def get_all_buckets(self, headers=None):
        response = self.make_request('GET', headers=headers)
        body = response.read()
        if response.status > 300:
            raise self.provider.storage_response_error(
                response.status, response.reason, body)
        rs = ResultSet([('Bucket', self.bucket_class)])
        h = handler.XmlHandler(rs, self)
        if not isinstance(body, bytes):
            body = body.encode('utf-8')
        xml.sax.parseString(body, h)
        return rs
github boto / boto / boto / ec2 / autoscale / group.py View on Github external
def startElement(self, name, attrs, connection):
        if name == 'Instances':
            self.instances = ResultSet([('member', Instance)])
            return self.instances
        elif name == 'LoadBalancerNames':
            return self.load_balancers
        elif name == 'AvailabilityZones':
            return self.availability_zones
        elif name == 'EnabledMetrics':
            self.enabled_metrics = ResultSet([('member', EnabledMetric)])
            return self.enabled_metrics
        elif name == 'SuspendedProcesses':
            self.suspended_processes = ResultSet([('member', SuspendedProcess)])
            return self.suspended_processes
        elif name == 'Tags':
            self.tags = ResultSet([('member', Tag)])
            return self.tags
        elif name == 'TerminationPolicies':
            return self.termination_policies
github GoogleCloudPlatform / gsutil / boto / connection.py View on Github external
def get_list(self, action, params, markers, path='/', parent=None, verb='GET'):
        if not parent:
            parent = self
        response = self.make_request(action, params, path, verb)
        body = response.read()
        boto.log.debug(body)
        if response.status == 200:
            rs = ResultSet(markers)
            h = handler.XmlHandler(rs, parent)
            xml.sax.parseString(body, h)
            return rs
        else:
            boto.log.error('%s %s' % (response.status, response.reason))
            boto.log.error('%s' % body)
            raise self.ResponseError(response.status, response.reason, body)
github Sage-Bionetworks / Synapse-Repository-Services / tools / SynapseDeployer / boto-2.1.1 / boto / connection.py View on Github external
def get_list(self, action, params, markers, path='/',
                 parent=None, verb='GET'):
        if not parent:
            parent = self
        response = self.make_request(action, params, path, verb)
        body = response.read()
        boto.log.debug(body)
        if not body:
            boto.log.error('Null body %s' % body)
            raise self.ResponseError(response.status, response.reason, body)
        elif response.status == 200:
            rs = ResultSet(markers)
            h = boto.handler.XmlHandler(rs, parent)
            xml.sax.parseString(body, h)
            return rs
        else:
            boto.log.error('%s %s' % (response.status, response.reason))
            boto.log.error('%s' % body)
            raise self.ResponseError(response.status, response.reason, body)