Skip to content

Instantly share code, notes, and snippets.

@AndrewBarfield
Created June 6, 2025 17:47
Show Gist options
  • Save AndrewBarfield/e8a0a48f7e463ab0c675743549813f97 to your computer and use it in GitHub Desktop.
Save AndrewBarfield/e8a0a48f7e463ab0c675743549813f97 to your computer and use it in GitHub Desktop.
Read RSS feed from Reddit without HTTP 403 error
import feedparser
# Some sites either require a standard UA or have blocked the feedparser UA
feedparser.USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"
# Reddit seems to require the 'accept-language' request header
fpd = feedparser.parse("https://www.reddit.com/r/ApteraMotors/.rss",
request_headers={
'accept-language': 'en-US,en;q=0.9'})
# Show the feed and attributes
print(fpd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment