jcgregorio | 26c0cd7 | 2006-07-03 17:36:17 +0000 | [diff] [blame^] | 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <link rel="STYLESHEET" href="ref.css" type='text/css' /> |
| 5 | <link rel="first" href="ref.html" title='The httplib2 Library' /> |
| 6 | <link rel='contents' href='contents.html' title="Contents" /> |
| 7 | <link rel='last' href='about.html' title='About this document...' /> |
| 8 | <link rel='help' href='about.html' title='About this document...' /> |
| 9 | <link rel="next" href="cache-objects.html" /> |
| 10 | <link rel="prev" href="module-httplib2.html" /> |
| 11 | <link rel="parent" href="module-httplib2.html" /> |
| 12 | <link rel="next" href="cache-objects.html" /> |
| 13 | <meta name='aesop' content='information' /> |
| 14 | <title>1.1.1 Http Objects</title> |
| 15 | </head> |
| 16 | <body> |
| 17 | <DIV CLASS="navigation"> |
| 18 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> |
| 19 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 20 | <tr> |
| 21 | <td class='online-navigation'><a rel="prev" title="1.1 httplib2 A comprehensive" |
| 22 | href="module-httplib2.html"><img src='previous.png' |
| 23 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 24 | <td class='online-navigation'><a rel="parent" title="1.1 httplib2 A comprehensive" |
| 25 | href="module-httplib2.html"><img src='up.png' |
| 26 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 27 | <td class='online-navigation'><a rel="next" title="1.1.2 Cache Objects" |
| 28 | href="cache-objects.html"><img src='next.png' |
| 29 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 30 | <td align="center" width="100%">The httplib2 Library</td> |
| 31 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 32 | href="contents.html"><img src='contents.png' |
| 33 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 34 | <td class='online-navigation'><img src='blank.png' |
| 35 | border='0' height='32' alt='' width='32' /></td> |
| 36 | <td class='online-navigation'><img src='blank.png' |
| 37 | border='0' height='32' alt='' width='32' /></td> |
| 38 | </tr></table> |
| 39 | <div class='online-navigation'> |
| 40 | <b class="navlabel">Previous:</b> |
| 41 | <a class="sectref" rel="prev" href="module-httplib2.html">1.1 httplib2 A comprehensive</A> |
| 42 | <b class="navlabel">Up:</b> |
| 43 | <a class="sectref" rel="parent" href="module-httplib2.html">1.1 httplib2 A comprehensive</A> |
| 44 | <b class="navlabel">Next:</b> |
| 45 | <a class="sectref" rel="next" href="cache-objects.html">1.1.2 Cache Objects</A> |
| 46 | </div> |
| 47 | <hr /></div> |
| 48 | </DIV> |
| 49 | <!--End of Navigation Panel--> |
| 50 | |
| 51 | <H2><A NAME="SECTION002110000000000000000"></A> |
| 52 | <A NAME="http-objects"></A> |
| 53 | <BR> |
| 54 | 1.1.1 Http Objects |
| 55 | </H2> |
| 56 | |
| 57 | <P> |
| 58 | Http objects have the following methods: |
| 59 | |
| 60 | <P> |
| 61 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 62 | <td><nobr><b><tt id='l2h-11' xml:id='l2h-11' class="method">request</tt></b>(</nobr></td> |
| 63 | <td><var>uri, </var><big>[</big><var>method="GET", body=None, headers=None, redirections=DEFAULT_MAX_REDIRECTS</var><big>]</big><var></var>)</td></tr></table></dt> |
| 64 | <dd> |
| 65 | Performs a single HTTP request. |
| 66 | The <var>uri</var> is the URI of the HTTP resource and can begin with either <code>http</code> or <code>https</code>. The value of <var>uri</var> must be an absolute URI. |
| 67 | |
| 68 | <P> |
| 69 | The <var>method</var> is the HTTP method to perform, such as <code>GET</code>, <code>POST</code>, <code>DELETE</code>, etc. There is no restriction |
| 70 | on the methods allowed. |
| 71 | |
| 72 | <P> |
| 73 | The <var>body</var> is the entity body to be sent with the request. It is a string |
| 74 | object. |
| 75 | |
| 76 | <P> |
| 77 | Any extra headers that are to be sent with the request should be provided in the |
| 78 | <var>headers</var> dictionary. |
| 79 | |
| 80 | <P> |
| 81 | The maximum number of redirect to follow before raising an exception is <var>redirections</var>. The default is 5. |
| 82 | |
| 83 | <P> |
| 84 | The return value is a tuple of (response, content), the first being and instance of the |
| 85 | <tt class="class">Response</tt> class, the second being a string that contains the response entity body. |
| 86 | </dl> |
| 87 | |
| 88 | <P> |
| 89 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 90 | <td><nobr><b><tt id='l2h-12' xml:id='l2h-12' class="method">add_credentials</tt></b>(</nobr></td> |
| 91 | <td><var>name, password</var>)</td></tr></table></dt> |
| 92 | <dd> |
| 93 | Adds a name and password that will be used when a request |
| 94 | requires authentication. |
| 95 | </dl> |
| 96 | |
| 97 | <P> |
| 98 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 99 | <td><nobr><b><tt id='l2h-13' xml:id='l2h-13' class="method">clear_credentials</tt></b>(</nobr></td> |
| 100 | <td><var></var>)</td></tr></table></dt> |
| 101 | <dd> |
| 102 | Remove all the names and passwords used for authentication. |
| 103 | </dl> |
| 104 | |
| 105 | <P> |
| 106 | <dl><dt><b><tt id='l2h-14' xml:id='l2h-14' class="member">follow_all_redirects</tt></b></dt> |
| 107 | <dd> |
| 108 | If <code>false</code>, which is the default, only safe redirects are followed, where |
| 109 | safe means that the client is only doing a <code>GET</code> or <code>HEAD</code> on the |
| 110 | URI to which it is being redirected. If <code>true</code> then all redirects are followed. |
| 111 | </dl> |
| 112 | |
| 113 | <P> |
| 114 | |
| 115 | <DIV CLASS="navigation"> |
| 116 | <div class='online-navigation'> |
| 117 | <p></p><hr /> |
| 118 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 119 | <tr> |
| 120 | <td class='online-navigation'><a rel="prev" title="1.1 httplib2 A comprehensive" |
| 121 | href="module-httplib2.html"><img src='previous.png' |
| 122 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 123 | <td class='online-navigation'><a rel="parent" title="1.1 httplib2 A comprehensive" |
| 124 | href="module-httplib2.html"><img src='up.png' |
| 125 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 126 | <td class='online-navigation'><a rel="next" title="1.1.2 Cache Objects" |
| 127 | href="cache-objects.html"><img src='next.png' |
| 128 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 129 | <td align="center" width="100%">The httplib2 Library</td> |
| 130 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 131 | href="contents.html"><img src='contents.png' |
| 132 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 133 | <td class='online-navigation'><img src='blank.png' |
| 134 | border='0' height='32' alt='' width='32' /></td> |
| 135 | <td class='online-navigation'><img src='blank.png' |
| 136 | border='0' height='32' alt='' width='32' /></td> |
| 137 | </tr></table> |
| 138 | <div class='online-navigation'> |
| 139 | <b class="navlabel">Previous:</b> |
| 140 | <a class="sectref" rel="prev" href="module-httplib2.html">1.1 httplib2 A comprehensive</A> |
| 141 | <b class="navlabel">Up:</b> |
| 142 | <a class="sectref" rel="parent" href="module-httplib2.html">1.1 httplib2 A comprehensive</A> |
| 143 | <b class="navlabel">Next:</b> |
| 144 | <a class="sectref" rel="next" href="cache-objects.html">1.1.2 Cache Objects</A> |
| 145 | </div> |
| 146 | </div> |
| 147 | <hr /> |
| 148 | <span class="release-info">Release 0.2, documentation updated on July 2, 2006.</span> |
| 149 | </DIV> |
| 150 | <!--End of Navigation Panel--> |
| 151 | |
| 152 | </BODY> |
| 153 | </HTML> |