User-Agent and Referer Headers

Customizing the User-Agent

feedparser does not send a User-Agent header when it requests a feed from a web server.

If you are using feedparser in an application, you should set the User-Agent to your application name and URL.

>>> import feedparser
>>> d = feedparser.parse(
...     "https://feedparser.readthedocs.io/en/main/examples/atom10.xml",
...     agent="MyApp/1.0 +http://domain.example/",
... )

Customizing the referrer

feedparser lets you set the Referer header when it requests a feed from a web server.

>>> import feedparser
>>> d = feedparser.parse(
...     "https://feedparser.readthedocs.io/en/main/examples/atom10.xml",
...     referrer="https://domain.example/",
... )