The default User-Agent string looks like this:
UniversalFeedParser/4.1 +http://feedparser.org/
If you are embedding Universal Feed Parser in a larger application, you should change the User-Agent to your application name and URL.
![link to this example [link]](images/permalink.gif)
Example: Customizing the User-Agent
>>> import feedparser >>> d = feedparser.parse('http://feedparser.org/docs/examples/atom10.xml', \ ... agent='MyApp/1.0 +http://example.com/')
You can also set the User-Agent once, globally, and then call the parse function normally.
![link to this example [link]](images/permalink.gif)
Example: Customizing the User-Agent permanently
>>> import feedparser >>> feedparser.USER_AGENT = "MyApp/1.0 +http://example.com/" >>> d = feedparser.parse('http://feedparser.org/docs/examples/atom10.xml')
Universal Feed Parser also lets you set the referrer when you download a feed from a web server. This is discouraged, because it is a violation of RFC 2616. The default behavior is to send a blank referrer, and you should never need to override this.
![link to this example [link]](images/permalink.gif)
Example: Customizing the referrer
>>> import feedparser >>> d = feedparser.parse('http://feedparser.org/docs/examples/atom10.xml', \ ... referrer='http://example.com/')