def write_feed(bucket, folder, region): episode_data = get_episode_data(bucket, folder, region) feed_path = path.join(folder, FEED_FILENAME) domain = DOMAIN.format(bucket=bucket, region=region) encoded_path = quote_plus(feed_path, safe='/') feed_url = urljoin(domain, encoded_path) print(feed_path, feed_url) feed_data = { 'title': escape(folder), 'description': escape(folder), 'url': feed_url, 'path': feed_path, 'encoded_path': encoded_path, } feed = rssfeed(feed_data, episode_data) print(feed) s3.put_object( Bucket=bucket, Key=feed_path, Body=feed, ContentType='application/xml' ) return feed_data