def sso_token(subscription_id, cloud_service_name, resource_type, resource_name): signature = "%s:%s:%s:%s" % (subscription_id, cloud_service_name, resource_name, sso_secret) token = hashlib.sha1(signature) timestamp = str(datetime.now()) x = XMLBuilder('SsoToken', xmlns='http://schemas.microsoft.com/windowsazure') x.TimeStamp(timestamp) x.Token(str(token.hexdigest())) response_string = str(x) app.logger.debug(response_string) return Response(response_string, status=200, mimetype='text/xml')