~pythoneers/ubuntu/lucid/feedparser/ltsppa

« back to all changes in this revision

Viewing changes to docs/http-useragent.html

  • Committer: Bazaar Package Importer
  • Author(s): Carlos Galisteo
  • Date: 2007-01-09 15:27:45 UTC
  • mfrom: (2.1.4 feisty)
  • Revision ID: james.westby@ubuntu.com-20070109152745-pg3zhn67yyaumwv3
Tags: 4.1-7
Fixed css link for *.html inside /doc. (Closes: #405343)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
<!DOCTYPE html
3
 
  PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
 
1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
4
2
<html lang="en">
5
 
   <head>
6
 
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
7
 
   
8
 
      <title>User-Agent and Referer Headers [Universal Feed Parser]</title>
9
 
      <link rel="stylesheet" href="../css/feedparser.css" type="text/css">
10
 
      <link rev="made" href="mailto:mark@diveintomark.org">
11
 
      <meta name="generator" content="DocBook XSL Stylesheets V1.65.1">
12
 
      <meta name="keywords" content="RSS, Atom, CDF, XML, feed, parser, Python">
13
 
      <link rel="start" href="index.html" title="Documentation">
14
 
      <link rel="up" href="http.html" title="HTTP Features">
15
 
      <link rel="prev" href="http-etag.html" title="ETag and Last-Modified Headers">
16
 
      <link rel="next" href="http-redirect.html" title="HTTP Redirects">
17
 
   </head>
18
 
   <body id="feedparser-org" class="docs">
19
 
      <!--#include virtual="/inc/header.html"-->
20
 
      <div id="main">
21
 
         <div id="mainInner">
22
 
            <p id="breadcrumb">You are here: <a href="../">Home</a> &#8594; <a href="index.html">Documentation</a> &#8594; <a href="http.html">HTTP Features</a> &#8594; <span class="thispage">User-Agent and Referer Headers</span></p>
23
 
            <div class="section" lang="en">
24
 
               <div class="titlepage">
25
 
                  <div>
26
 
                     <div>
27
 
                        <h2 class="title"><a name="http.useragent" class="skip" href="#http.useragent" title="link to this section"><img src="images/permalink.gif" alt="[link]" title="link to this section" width="8" height="9"></a> User-Agent and Referer Headers
28
 
                        </h2>
29
 
                     </div>
30
 
                     <div>
31
 
                        <div class="abstract">
32
 
                           <h3 class="title"></h3>
33
 
                           <p><span class="application">Universal Feed Parser</span> sends a default User-Agent string when it requests a feed from a web server.
34
 
                           </p>
35
 
                        </div>
36
 
                     </div>
37
 
                  </div>
38
 
                  <div></div>
39
 
               </div>
40
 
               <div class="informalexample">
41
 
                  <p>The default User-Agent string looks like this:</p><pre class="programlisting ">UniversalFeedParser/4.0 +http://feedparser.org/</pre></div>
42
 
               <p>If you are embedding <span class="application">Universal Feed Parser</span> in a larger application, you should change the User-Agent to your application name and <acronym title="Uniform Resource Locator">URL</acronym>.
43
 
               </p>
44
 
               <div class="example"><a name="example.useragent" class="skip" href="#example.useragent" title="link to this example"><img src="images/permalink.gif" alt="[link]" title="link to this example" width="8" height="9"></a> 
45
 
                  <h3 class="title">Example:&nbsp;Customizing the User-Agent</h3><pre class="screen"><tt class="prompt">&gt;&gt;&gt; </tt><span class="userinput"><font color='navy'><b>import</b></font> feedparser</span>
 
3
<head>
 
4
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 
5
<title>User-Agent and Referer Headers [Universal Feed Parser]</title>
 
6
<link rel="stylesheet" href="css/feedparser.css" type="text/css">
 
7
<link rev="made" href="mailto:mark@diveintomark.org">
 
8
<meta name="generator" content="DocBook XSL Stylesheets V1.65.1">
 
9
<meta name="keywords" content="RSS, Atom, CDF, XML, feed, parser, Python">
 
10
<link rel="start" href="index.html" title="Documentation">
 
11
<link rel="up" href="http.html" title="HTTP Features">
 
12
<link rel="prev" href="http-etag.html" title="ETag and Last-Modified Headers">
 
13
<link rel="next" href="http-redirect.html" title="HTTP Redirects">
 
14
</head>
 
15
<body id="feedparser-org" class="docs">
 
16
<div class="z" id="intro"><div class="sectionInner"><div class="sectionInner2">
 
17
<div class="s" id="pageHeader">
 
18
<h1><a href="/"><span>Universal Feed Parser</span></a></h1>
 
19
<p><span>Parse RSS and Atom feeds in Python.  3000 unit tests.  Open source.</span></p>
 
20
</div>
 
21
<div class="s" id="quickSummary"><ul>
 
22
<li class="li1">
 
23
<a href="http://sourceforge.net/projects/feedparser/"><span>Download</span></a> ·</li>
 
24
<li class="li2">
 
25
<a href="http://feedparser.org/docs/"><span>Documentation</span></a> ·</li>
 
26
<li class="li3">
 
27
<a href="http://feedparser.org/tests/"><span>Unit tests</span></a> ·</li>
 
28
<li class="li4"><a href="http://sourceforge.net/tracker/?func=browse&amp;group_id=112328&amp;atid=661937"><span>Report a bug</span></a></li>
 
29
</ul></div>
 
30
</div></div></div>
 
31
<div id="main"><div id="mainInner">
 
32
<p id="breadcrumb">You are here: <a href="index.html">Documentation</a> → <a href="http.html">HTTP Features</a> → <span class="thispage">User-Agent and Referer Headers</span></p>
 
33
<div class="section" lang="en">
 
34
<div class="titlepage">
 
35
<div>
 
36
<div><h2 class="title">
 
37
<a name="http.useragent" class="skip" href="#http.useragent" title="link to this section"><img src="images/permalink.gif" alt="[link]" title="link to this section" width="8" height="9"></a> User-Agent and Referer Headers</h2></div>
 
38
<div><div class="abstract">
 
39
<h3 class="title"></h3>
 
40
<p><span class="application">Universal Feed Parser</span> sends a default User-Agent string when it requests a feed from a web server.</p>
 
41
</div></div>
 
42
</div>
 
43
<div></div>
 
44
</div>
 
45
<div class="informalexample">
 
46
<p>The default User-Agent string looks like this:</p>
 
47
<pre class="programlisting ">UniversalFeedParser/4.1 +http://feedparser.org/</pre>
 
48
</div>
 
49
<p>If you are embedding <span class="application">Universal Feed Parser</span> in a larger application, you should change the User-Agent to your application name and <acronym title="Uniform Resource Locator">URL</acronym>.</p>
 
50
<div class="example">
 
51
<a name="example.useragent" class="skip" href="#example.useragent" title="link to this example"><img src="images/permalink.gif" alt="[link]" title="link to this example" width="8" height="9"></a> <h3 class="title">Example: Customizing the User-Agent</h3>
 
52
<pre class="screen"><tt class="prompt">&gt;&gt;&gt; </tt><span class="userinput"><font color='navy'><b>import</b></font> feedparser</span>
46
53
<tt class="prompt">&gt;&gt;&gt; </tt><span class="userinput">d = feedparser.parse('<a href="http://feedparser.org/docs/examples/atom10.xml">http://feedparser.org/docs/examples/atom10.xml</a>', \</span>
47
 
<tt class="prompt">... </tt>    <span class="userinput">    agent=<font color='olive'>'MyApp/1.0 +http://example.com/'</font>)</span></pre></div>
48
 
               <p>You can also set the User-Agent once, globally, and then call the <tt class="function">parse</tt> function normally.
49
 
               </p>
50
 
               <div class="example"><a name="example.useragent.permanent" class="skip" href="#example.useragent.permanent" title="link to this example"><img src="images/permalink.gif" alt="[link]" title="link to this example" width="8" height="9"></a> 
51
 
                  <h3 class="title">Example:&nbsp;Customizing the User-Agent permanently</h3><pre class="screen"><tt class="prompt">&gt;&gt;&gt; </tt><span class="userinput"><font color='navy'><b>import</b></font> feedparser</span>
 
54
<tt class="prompt">... </tt>    <span class="userinput">    agent=<font color='olive'>'MyApp/1.0 +http://example.com/'</font>)</span></pre>
 
55
</div>
 
56
<p>You can also set the User-Agent once, globally, and then call the <tt class="function">parse</tt> function normally.</p>
 
57
<div class="example">
 
58
<a name="example.useragent.permanent" class="skip" href="#example.useragent.permanent" title="link to this example"><img src="images/permalink.gif" alt="[link]" title="link to this example" width="8" height="9"></a> <h3 class="title">Example: Customizing the User-Agent permanently</h3>
 
59
<pre class="screen"><tt class="prompt">&gt;&gt;&gt; </tt><span class="userinput"><font color='navy'><b>import</b></font> feedparser</span>
52
60
<tt class="prompt">&gt;&gt;&gt; </tt><span class="userinput">feedparser.USER_AGENT = <font color='olive'>"MyApp/1.0 +http://example.com/"</font></span>
53
 
<tt class="prompt">&gt;&gt;&gt; </tt><span class="userinput">d = feedparser.parse('<a href="http://feedparser.org/docs/examples/atom10.xml">http://feedparser.org/docs/examples/atom10.xml</a>')</span></pre></div>
54
 
               <p><span class="application">Universal Feed Parser</span> also lets you set the referrer when you download a feed from a web server.  This is discouraged, because it is a violation
55
 
                  of <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.36">RFC 2616</a>.  The default behavior is to send a blank referrer, and you should never need to override this.
56
 
               </p>
57
 
               <div class="example"><a name="example.referrer" class="skip" href="#example.referrer" title="link to this example"><img src="images/permalink.gif" alt="[link]" title="link to this example" width="8" height="9"></a> 
58
 
                  <h3 class="title">Example:&nbsp;Customizing the referrer</h3><pre class="screen"><tt class="prompt">&gt;&gt;&gt; </tt><span class="userinput"><font color='navy'><b>import</b></font> feedparser</span>
 
61
<tt class="prompt">&gt;&gt;&gt; </tt><span class="userinput">d = feedparser.parse('<a href="http://feedparser.org/docs/examples/atom10.xml">http://feedparser.org/docs/examples/atom10.xml</a>')</span></pre>
 
62
</div>
 
63
<p><span class="application">Universal Feed Parser</span> also lets you set the referrer when you download a feed from a web server.  This is discouraged, because it is a violation of <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.36">RFC 2616</a>.  The default behavior is to send a blank referrer, and you should never need to override this.</p>
 
64
<div class="example">
 
65
<a name="example.referrer" class="skip" href="#example.referrer" title="link to this example"><img src="images/permalink.gif" alt="[link]" title="link to this example" width="8" height="9"></a> <h3 class="title">Example: Customizing the referrer</h3>
 
66
<pre class="screen"><tt class="prompt">&gt;&gt;&gt; </tt><span class="userinput"><font color='navy'><b>import</b></font> feedparser</span>
59
67
<tt class="prompt">&gt;&gt;&gt; </tt><span class="userinput">d = feedparser.parse('<a href="http://feedparser.org/docs/examples/atom10.xml">http://feedparser.org/docs/examples/atom10.xml</a>', \</span>
60
 
<tt class="prompt">... </tt>    <span class="userinput">referrer=<font color='olive'>'http://example.com/'</font>)</span></pre></div>
61
 
            </div>
62
 
            <div style="float: left">&#8592;&nbsp;<a class="NavigationArrow" href="http-etag.html">ETag and Last-Modified Headers</a></div>
63
 
            <div style="text-align: right"><a class="NavigationArrow" href="http-redirect.html">HTTP Redirects</a>&nbsp;&#8594;
64
 
            </div>
65
 
            <hr style="clear:both">
66
 
            <div class="footer">
67
 
               <p class="copyright">Copyright &copy; 2004, 2005 Mark Pilgrim</p>
68
 
            </div>
69
 
         </div>
70
 
      </div>
71
 
   </body>
72
 
</html>
 
 
b'\\ No newline at end of file'
 
68
<tt class="prompt">... </tt>    <span class="userinput">referrer=<font color='olive'>'http://example.com/'</font>)</span></pre>
 
69
</div>
 
70
</div>
 
71
<div style="float: left">← <a class="NavigationArrow" href="http-etag.html">ETag and Last-Modified Headers</a>
 
72
</div>
 
73
<div style="text-align: right">
 
74
<a class="NavigationArrow" href="http-redirect.html">HTTP Redirects</a> →</div>
 
75
<hr style="clear:both">
 
76
<div class="footer"><p class="copyright">Copyright © 2004, 2005, 2006 Mark Pilgrim</p></div>
 
77
</div></div>
 
78
</body>
 
79
</html>