write_rss_feed_6.py 728 B

123456789101112131415161718192021222324
  1. def write_feed(bucket, folder, region):
  2. episode_data = get_episode_data(bucket, folder, region)
  3. feed_path = path.join(folder, FEED_FILENAME)
  4. domain = DOMAIN.format(bucket=bucket, region=region)
  5. encoded_path = quote_plus(feed_path, safe='/')
  6. feed_url = urljoin(domain, encoded_path)
  7. print(feed_path, feed_url)
  8. feed_data = {
  9. 'title': escape(folder),
  10. 'description': escape(folder),
  11. 'url': feed_url,
  12. 'path': feed_path,
  13. 'encoded_path': encoded_path,
  14. }
  15. feed = rssfeed(feed_data, episode_data)
  16. print(feed)
  17. s3.put_object(
  18. Bucket=bucket,
  19. Key=feed_path,
  20. Body=feed,
  21. ContentType='application/xml'
  22. )
  23. return feed_data