def create_distribution(self, origin, enabled, caller_reference='', cnames=None, comment=''): config = DistributionConfig(origin=origin, enabled=enabled, caller_reference=caller_reference, cnames=cnames, comment=comment) response = self.make_request('POST', '/%s/distribution' % self.Version, {'Content-Type' : 'text/xml'}, data=config.to_xml()) body = response.read() if response.status == 201: d = Distribution(connection=self) h = handler.XmlHandler(d, self) xml.sax.parseString(body, h) return d else: raise CloudFrontServerError(response.status, response.reason, body)
def create_distribution(self, origin, enabled, caller_reference='', cnames=None, comment=''): config = DistributionConfig(origin=origin, enabled=enabled, caller_reference=caller_reference, cnames=cnames, comment=comment) response = self.make_request('POST', '/%s/distribution' % self.Version, {'Content-Type': 'text/xml'}, data=config.to_xml()) body = response.read() if response.status == 201: d = Distribution(connection=self) h = handler.XmlHandler(d, self) xml.sax.parseString(body, h) return d else: raise CloudFrontServerError(response.status, response.reason, body)