def xml_for_subscription_event(subscription_id, event_type, resource_provider_namespace="cloudkeys", etag=None): if not etag: etag = utility.generate_etag() headers = [('Content-Type', 'application/xml')] x = XMLBuilder('EntityEvent', xmlns='http://schemas.microsoft.com/windowsazure') x.EventId(subscription_id) x.ListenerId(resource_provider_namespace) x.EntityType("Subscription") x.EntityState(event_type) with x.EntityId: x.Id(subscription_id) x.Created(str(datetime.now())) x.IsAsync("false") x.OperationId(etag) with x.Properties: with x.EntityProperty: x.PropertyName("ResourceType") x.PropertyValue("cloudkeys") with x.EntityProperty: x.PropertyName("EMail") x.PropertyValue("*****@*****.**") with x.EntityProperty: x.PropertyName("OptIn") x.PropertyValue("False") return str(x)