def _upload_batches(self, job, data):
    uri = '{}/job/{}/batch'.format(self.bulk.endpoint, job)
    headers = self.bulk.headers({'Content-Type': 'text/csv'})
    for batch in self._split_batches(data, 10000):
        rows = ['"Id"']
        rows += ['"{}"'.format(record['Id']) for record in batch]
        resp = requests.post(uri, data='\n'.join(rows), headers=headers)
        content = resp.content
        if (resp.status_code >= 400):
            self.bulk.raise_error(content, resp.status_code)
        tree = ET.fromstring(content)
        batch_id = tree.findtext(('{%s}id' % self.bulk.jobNS))
        (yield batch_id)
def _upload_batches(self, job, data):
    uri = '{}/job/{}/batch'.format(self.bulk.endpoint, job)
    headers = self.bulk.headers({'Content-Type': 'text/csv'})
    for batch in self._split_batches(data, 10000):
        rows = ['"Id"']
        rows += ['"{}"'.format(record['Id']) for record in batch]
        resp = requests.post(uri, data='\n'.join(rows), headers=headers)
        content = resp.content
        if (resp.status_code >= 400):
            self.bulk.raise_error(content, resp.status_code)
        tree = ET.fromstring(content)
        batch_id = tree.findtext(('{%s}id' % self.bulk.jobNS))
        (yield batch_id)