blob: f3478e25706a283523c11799d81ddca47448bf9b [file] [log] [blame]
Joe Gregorio30dfdc32010-12-09 16:34:22 -05001
2<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
3<html><head><title>Python: module apiclient.http</title>
4</head><body bgcolor="#f0f0f8">
5
6<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
7<tr bgcolor="#7799ee">
8<td valign=bottom>&nbsp;<br>
9<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong><a href="apiclient.html"><font color="#ffffff">apiclient</font></a>.http</strong></big></big></font></td
10><td align=right valign=bottom
Joe Gregorio3d55ac52012-02-21 10:11:19 -050011><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/usr/local/google/home/jcgregorio/projects/apiclient-release/apiclient/http.py">/usr/local/google/home/jcgregorio/projects/apiclient-release/apiclient/http.py</a></font></td></tr></table>
Joe Gregorio30dfdc32010-12-09 16:34:22 -050012 <p><tt>Classes&nbsp;to&nbsp;encapsulate&nbsp;a&nbsp;single&nbsp;HTTP&nbsp;request.<br>
13&nbsp;<br>
14The&nbsp;classes&nbsp;implement&nbsp;a&nbsp;command&nbsp;pattern,&nbsp;with&nbsp;every<br>
15<a href="__builtin__.html#object">object</a>&nbsp;supporting&nbsp;an&nbsp;execute()&nbsp;method&nbsp;that&nbsp;does&nbsp;the<br>
16actuall&nbsp;HTTP&nbsp;request.</tt></p>
17<p>
18<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
Joe Gregorio6e537032011-02-09 23:04:26 -050019<tr bgcolor="#aa55cc">
20<td colspan=3 valign=bottom>&nbsp;<br>
21<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
22
23<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
Joe Gregoriob417caf2011-12-08 12:04:24 -050024<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="StringIO.html">StringIO</a><br>
Joe Gregorio3d55ac52012-02-21 10:11:19 -050025<a href="base64.html">base64</a><br>
Joe Gregoriob417caf2011-12-08 12:04:24 -050026<a href="copy.html">copy</a><br>
Joe Gregorio3d55ac52012-02-21 10:11:19 -050027</td><td width="25%" valign=top><a href="gzip.html">gzip</a><br>
28<a href="httplib2.html">httplib2</a><br>
Joe Gregoriob417caf2011-12-08 12:04:24 -050029<a href="apiclient.mimeparse.html">apiclient.mimeparse</a><br>
Joe Gregorio3d55ac52012-02-21 10:11:19 -050030</td><td width="25%" valign=top><a href="mimetypes.html">mimetypes</a><br>
31<a href="os.html">os</a><br>
32<a href="json.html">json</a><br>
33</td><td width="25%" valign=top><a href="urllib.html">urllib</a><br>
34<a href="urlparse.html">urlparse</a><br>
Joe Gregoriob417caf2011-12-08 12:04:24 -050035<a href="uuid.html">uuid</a><br>
36</td></tr></table></td></tr></table><p>
Joe Gregorio6e537032011-02-09 23:04:26 -050037<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
Joe Gregorio30dfdc32010-12-09 16:34:22 -050038<tr bgcolor="#ee77aa">
39<td colspan=3 valign=bottom>&nbsp;<br>
40<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
41
42<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
43<td width="100%"><dl>
44<dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a>
45</font></dt><dd>
46<dl>
Joe Gregorio20a5aa92011-04-01 17:44:25 -040047<dt><font face="helvetica, arial"><a href="apiclient.http.html#HttpRequest">HttpRequest</a>
Joe Gregorio30dfdc32010-12-09 16:34:22 -050048</font></dt><dt><font face="helvetica, arial"><a href="apiclient.http.html#RequestMockBuilder">RequestMockBuilder</a>
49</font></dt></dl>
50</dd>
51</dl>
52 <p>
53<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
54<tr bgcolor="#ffc8d8">
55<td colspan=3 valign=bottom>&nbsp;<br>
56<font color="#000000" face="helvetica, arial"><a name="HttpRequest">class <strong>HttpRequest</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
57
58<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
59<td colspan=2><tt>Encapsulates&nbsp;a&nbsp;single&nbsp;HTTP&nbsp;request.<br>&nbsp;</tt></td></tr>
60<tr><td>&nbsp;</td>
61<td width="100%">Methods defined here:<br>
Joe Gregoriob417caf2011-12-08 12:04:24 -050062<dl><dt><a name="HttpRequest-__init__"><strong>__init__</strong></a>(self, http, postproc, uri, method<font color="#909090">='GET'</font>, body<font color="#909090">=None</font>, headers<font color="#909090">=None</font>, methodId<font color="#909090">=None</font>, resumable<font color="#909090">=None</font>)</dt><dd><tt>Constructor&nbsp;for&nbsp;an&nbsp;<a href="#HttpRequest">HttpRequest</a>.<br>
Joe Gregorio30dfdc32010-12-09 16:34:22 -050063&nbsp;<br>
64Args:<br>
65&nbsp;&nbsp;http:&nbsp;httplib2.Http,&nbsp;the&nbsp;transport&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;to&nbsp;use&nbsp;to&nbsp;make&nbsp;a&nbsp;request<br>
Joe Gregorioabda96f2011-02-11 20:19:33 -050066&nbsp;&nbsp;postproc:&nbsp;callable,&nbsp;called&nbsp;on&nbsp;the&nbsp;HTTP&nbsp;response&nbsp;and&nbsp;content&nbsp;to&nbsp;transform<br>
67&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;it&nbsp;into&nbsp;a&nbsp;data&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;before&nbsp;returning,&nbsp;or&nbsp;raising&nbsp;an&nbsp;exception<br>
68&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;on&nbsp;an&nbsp;error.<br>
Joe Gregorio30dfdc32010-12-09 16:34:22 -050069&nbsp;&nbsp;uri:&nbsp;string,&nbsp;the&nbsp;absolute&nbsp;URI&nbsp;to&nbsp;send&nbsp;the&nbsp;request&nbsp;to<br>
70&nbsp;&nbsp;method:&nbsp;string,&nbsp;the&nbsp;HTTP&nbsp;method&nbsp;to&nbsp;use<br>
Joe Gregoriob417caf2011-12-08 12:04:24 -050071&nbsp;&nbsp;body:&nbsp;string,&nbsp;the&nbsp;request&nbsp;body&nbsp;of&nbsp;the&nbsp;HTTP&nbsp;request,<br>
Joe Gregorio30dfdc32010-12-09 16:34:22 -050072&nbsp;&nbsp;headers:&nbsp;dict,&nbsp;the&nbsp;HTTP&nbsp;request&nbsp;headers<br>
Joe Gregoriob417caf2011-12-08 12:04:24 -050073&nbsp;&nbsp;methodId:&nbsp;string,&nbsp;a&nbsp;unique&nbsp;identifier&nbsp;for&nbsp;the&nbsp;API&nbsp;method&nbsp;being&nbsp;called.<br>
74&nbsp;&nbsp;resumable:&nbsp;MediaUpload,&nbsp;None&nbsp;if&nbsp;this&nbsp;is&nbsp;not&nbsp;a&nbsp;resumbale&nbsp;request.</tt></dd></dl>
Joe Gregorio30dfdc32010-12-09 16:34:22 -050075
76<dl><dt><a name="HttpRequest-execute"><strong>execute</strong></a>(self, http<font color="#909090">=None</font>)</dt><dd><tt>Execute&nbsp;the&nbsp;request.<br>
77&nbsp;<br>
78Args:<br>
79&nbsp;&nbsp;http:&nbsp;httplib2.Http,&nbsp;an&nbsp;http&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;to&nbsp;be&nbsp;used&nbsp;in&nbsp;place&nbsp;of&nbsp;the<br>
80&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;one&nbsp;the&nbsp;<a href="#HttpRequest">HttpRequest</a>&nbsp;request&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;was&nbsp;constructed&nbsp;with.<br>
81&nbsp;<br>
82Returns:<br>
83&nbsp;&nbsp;A&nbsp;deserialized&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;model&nbsp;of&nbsp;the&nbsp;response&nbsp;body&nbsp;as&nbsp;determined<br>
84&nbsp;&nbsp;by&nbsp;the&nbsp;postproc.<br>
85&nbsp;<br>
86Raises:<br>
87&nbsp;&nbsp;apiclient.errors.HttpError&nbsp;if&nbsp;the&nbsp;response&nbsp;was&nbsp;not&nbsp;a&nbsp;2xx.<br>
88&nbsp;&nbsp;httplib2.Error&nbsp;if&nbsp;a&nbsp;transport&nbsp;error&nbsp;has&nbsp;occured.</tt></dd></dl>
89
Joe Gregoriob417caf2011-12-08 12:04:24 -050090<dl><dt><a name="HttpRequest-next_chunk"><strong>next_chunk</strong></a>(self, http<font color="#909090">=None</font>)</dt><dd><tt>Execute&nbsp;the&nbsp;next&nbsp;step&nbsp;of&nbsp;a&nbsp;resumable&nbsp;upload.<br>
91&nbsp;<br>
92Can&nbsp;only&nbsp;be&nbsp;used&nbsp;if&nbsp;the&nbsp;method&nbsp;being&nbsp;executed&nbsp;supports&nbsp;media&nbsp;uploads&nbsp;and<br>
93the&nbsp;MediaUpload&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;passed&nbsp;in&nbsp;was&nbsp;flagged&nbsp;as&nbsp;using&nbsp;resumable&nbsp;upload.<br>
94&nbsp;<br>
95Example:<br>
96&nbsp;<br>
97&nbsp;&nbsp;media&nbsp;=&nbsp;MediaFileUpload('smiley.png',&nbsp;mimetype='image/png',<br>
98&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;chunksize=1000,&nbsp;resumable=True)<br>
99&nbsp;&nbsp;request&nbsp;=&nbsp;service.objects().insert(<br>
100&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bucket=buckets['items'][0]['id'],<br>
101&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name='smiley.png',<br>
102&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;media_body=media)<br>
103&nbsp;<br>
104&nbsp;&nbsp;response&nbsp;=&nbsp;None<br>
105&nbsp;&nbsp;while&nbsp;response&nbsp;is&nbsp;None:<br>
106&nbsp;&nbsp;&nbsp;&nbsp;status,&nbsp;response&nbsp;=&nbsp;request.<a href="#HttpRequest-next_chunk">next_chunk</a>()<br>
107&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;status:<br>
108&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;"Upload&nbsp;%d%%&nbsp;complete."&nbsp;%&nbsp;int(status.progress()&nbsp;*&nbsp;100)<br>
109&nbsp;<br>
110&nbsp;<br>
111Returns:<br>
112&nbsp;&nbsp;(status,&nbsp;body):&nbsp;(ResumableMediaStatus,&nbsp;<a href="__builtin__.html#object">object</a>)<br>
113&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;body&nbsp;will&nbsp;be&nbsp;None&nbsp;until&nbsp;the&nbsp;resumable&nbsp;media&nbsp;is&nbsp;fully&nbsp;uploaded.</tt></dd></dl>
114
115<dl><dt><a name="HttpRequest-to_json"><strong>to_json</strong></a>(self)</dt><dd><tt>Returns&nbsp;a&nbsp;JSON&nbsp;representation&nbsp;of&nbsp;the&nbsp;<a href="#HttpRequest">HttpRequest</a>.</tt></dd></dl>
116
117<hr>
118Static methods defined here:<br>
119<dl><dt><a name="HttpRequest-from_json"><strong>from_json</strong></a>(s, http, postproc)</dt><dd><tt>Returns&nbsp;an&nbsp;<a href="#HttpRequest">HttpRequest</a>&nbsp;populated&nbsp;with&nbsp;info&nbsp;from&nbsp;a&nbsp;JSON&nbsp;<a href="__builtin__.html#object">object</a>.</tt></dd></dl>
120
Joe Gregorio30dfdc32010-12-09 16:34:22 -0500121<hr>
122Data descriptors defined here:<br>
123<dl><dt><strong>__dict__</strong></dt>
124<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
125</dl>
126<dl><dt><strong>__weakref__</strong></dt>
127<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
128</dl>
129</td></tr></table> <p>
130<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
131<tr bgcolor="#ffc8d8">
132<td colspan=3 valign=bottom>&nbsp;<br>
133<font color="#000000" face="helvetica, arial"><a name="RequestMockBuilder">class <strong>RequestMockBuilder</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
134
135<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
136<td colspan=2><tt>A&nbsp;simple&nbsp;mock&nbsp;of&nbsp;<a href="#HttpRequest">HttpRequest</a><br>
137&nbsp;<br>
138Pass&nbsp;in&nbsp;a&nbsp;dictionary&nbsp;to&nbsp;the&nbsp;constructor&nbsp;that&nbsp;maps&nbsp;request&nbsp;methodIds&nbsp;to<br>
Joe Gregorioa8451672011-09-15 09:53:21 -0400139tuples&nbsp;of&nbsp;(httplib2.Response,&nbsp;content,&nbsp;opt_expected_body)&nbsp;that&nbsp;should&nbsp;be<br>
140returned&nbsp;when&nbsp;that&nbsp;method&nbsp;is&nbsp;called.&nbsp;None&nbsp;may&nbsp;also&nbsp;be&nbsp;passed&nbsp;in&nbsp;for&nbsp;the<br>
141httplib2.Response,&nbsp;in&nbsp;which&nbsp;case&nbsp;a&nbsp;200&nbsp;OK&nbsp;response&nbsp;will&nbsp;be&nbsp;generated.<br>
142If&nbsp;an&nbsp;opt_expected_body&nbsp;(str&nbsp;or&nbsp;dict)&nbsp;is&nbsp;provided,&nbsp;it&nbsp;will&nbsp;be&nbsp;compared&nbsp;to<br>
143the&nbsp;body&nbsp;and&nbsp;UnexpectedBodyError&nbsp;will&nbsp;be&nbsp;raised&nbsp;on&nbsp;inequality.<br>
Joe Gregorio30dfdc32010-12-09 16:34:22 -0500144&nbsp;<br>
145Example:<br>
146&nbsp;&nbsp;response&nbsp;=&nbsp;'{"data":&nbsp;{"id":&nbsp;"tag:google.c...'<br>
147&nbsp;&nbsp;requestBuilder&nbsp;=&nbsp;<a href="#RequestMockBuilder">RequestMockBuilder</a>(<br>
148&nbsp;&nbsp;&nbsp;&nbsp;{<br>
Joe Gregorioc4fc0952011-11-09 12:21:11 -0500149&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'plus.activities.get':&nbsp;(None,&nbsp;response),<br>
Joe Gregorio30dfdc32010-12-09 16:34:22 -0500150&nbsp;&nbsp;&nbsp;&nbsp;}<br>
151&nbsp;&nbsp;)<br>
Joe Gregorioc4fc0952011-11-09 12:21:11 -0500152&nbsp;&nbsp;apiclient.discovery.build("plus",&nbsp;"v1",&nbsp;requestBuilder=requestBuilder)<br>
Joe Gregorio30dfdc32010-12-09 16:34:22 -0500153&nbsp;<br>
154Methods&nbsp;that&nbsp;you&nbsp;do&nbsp;not&nbsp;supply&nbsp;a&nbsp;response&nbsp;for&nbsp;will&nbsp;return&nbsp;a<br>
Joe Gregoriob417caf2011-12-08 12:04:24 -0500155200&nbsp;OK&nbsp;with&nbsp;an&nbsp;empty&nbsp;string&nbsp;as&nbsp;the&nbsp;response&nbsp;content&nbsp;or&nbsp;raise&nbsp;an&nbsp;excpetion<br>
156if&nbsp;check_unexpected&nbsp;is&nbsp;set&nbsp;to&nbsp;True.&nbsp;The&nbsp;methodId&nbsp;is&nbsp;taken&nbsp;from&nbsp;the&nbsp;rpcName<br>
Joe Gregorioa8451672011-09-15 09:53:21 -0400157in&nbsp;the&nbsp;discovery&nbsp;document.<br>
Joe Gregorio30dfdc32010-12-09 16:34:22 -0500158&nbsp;<br>
159For&nbsp;more&nbsp;details&nbsp;see&nbsp;the&nbsp;project&nbsp;wiki.<br>&nbsp;</tt></td></tr>
160<tr><td>&nbsp;</td>
161<td width="100%">Methods defined here:<br>
Joe Gregoriob417caf2011-12-08 12:04:24 -0500162<dl><dt><a name="RequestMockBuilder-__call__"><strong>__call__</strong></a>(self, http, postproc, uri, method<font color="#909090">='GET'</font>, body<font color="#909090">=None</font>, headers<font color="#909090">=None</font>, methodId<font color="#909090">=None</font>, resumable<font color="#909090">=None</font>)</dt><dd><tt>Implements&nbsp;the&nbsp;callable&nbsp;interface&nbsp;that&nbsp;discovery.build()&nbsp;expects<br>
Joe Gregorio30dfdc32010-12-09 16:34:22 -0500163of&nbsp;requestBuilder,&nbsp;which&nbsp;is&nbsp;to&nbsp;build&nbsp;an&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;compatible&nbsp;with<br>
164<a href="#HttpRequest">HttpRequest</a>.execute().&nbsp;See&nbsp;that&nbsp;method&nbsp;for&nbsp;the&nbsp;description&nbsp;of&nbsp;the<br>
165parameters&nbsp;and&nbsp;the&nbsp;expected&nbsp;response.</tt></dd></dl>
166
Joe Gregorioa8451672011-09-15 09:53:21 -0400167<dl><dt><a name="RequestMockBuilder-__init__"><strong>__init__</strong></a>(self, responses, check_unexpected<font color="#909090">=False</font>)</dt><dd><tt>Constructor&nbsp;for&nbsp;<a href="#RequestMockBuilder">RequestMockBuilder</a><br>
Joe Gregorio30dfdc32010-12-09 16:34:22 -0500168&nbsp;<br>
169The&nbsp;constructed&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;should&nbsp;be&nbsp;a&nbsp;callable&nbsp;<a href="__builtin__.html#object">object</a><br>
170that&nbsp;can&nbsp;replace&nbsp;the&nbsp;class&nbsp;HttpResponse.<br>
171&nbsp;<br>
172responses&nbsp;-&nbsp;A&nbsp;dictionary&nbsp;that&nbsp;maps&nbsp;methodIds&nbsp;into&nbsp;tuples<br>
173&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;of&nbsp;(httplib2.Response,&nbsp;content).&nbsp;The&nbsp;methodId<br>
174&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;comes&nbsp;from&nbsp;the&nbsp;'rpcName'&nbsp;field&nbsp;in&nbsp;the&nbsp;discovery<br>
Joe Gregorioa8451672011-09-15 09:53:21 -0400175&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.<br>
176check_unexpected&nbsp;-&nbsp;A&nbsp;boolean&nbsp;setting&nbsp;whether&nbsp;or&nbsp;not&nbsp;UnexpectedMethodError<br>
177&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;should&nbsp;be&nbsp;raised&nbsp;on&nbsp;unsupplied&nbsp;method.</tt></dd></dl>
Joe Gregorio30dfdc32010-12-09 16:34:22 -0500178
179<hr>
180Data descriptors defined here:<br>
181<dl><dt><strong>__dict__</strong></dt>
182<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
183</dl>
184<dl><dt><strong>__weakref__</strong></dt>
185<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
186</dl>
187</td></tr></table></td></tr></table><p>
188<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
Joe Gregorio20a5aa92011-04-01 17:44:25 -0400189<tr bgcolor="#eeaa77">
190<td colspan=3 valign=bottom>&nbsp;<br>
191<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
192
193<tr><td bgcolor="#eeaa77"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
194<td width="100%"><dl><dt><a name="-tunnel_patch"><strong>tunnel_patch</strong></a>(http)</dt><dd><tt>Tunnel&nbsp;PATCH&nbsp;requests&nbsp;over&nbsp;POST.<br>
195Args:<br>
196&nbsp;&nbsp;&nbsp;http&nbsp;-&nbsp;An&nbsp;instance&nbsp;of&nbsp;httplib2.Http<br>
197&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or&nbsp;something&nbsp;that&nbsp;acts&nbsp;like&nbsp;it.<br>
198&nbsp;<br>
199Returns:<br>
200&nbsp;&nbsp;&nbsp;A&nbsp;modified&nbsp;instance&nbsp;of&nbsp;http&nbsp;that&nbsp;was&nbsp;passed&nbsp;in.<br>
201&nbsp;<br>
202Example:<br>
203&nbsp;<br>
204&nbsp;&nbsp;h&nbsp;=&nbsp;httplib2.Http()<br>
205&nbsp;&nbsp;h&nbsp;=&nbsp;<a href="#-tunnel_patch">tunnel_patch</a>(h,&nbsp;"my-app-name/6.0")<br>
206&nbsp;<br>
207Useful&nbsp;if&nbsp;you&nbsp;are&nbsp;running&nbsp;on&nbsp;a&nbsp;platform&nbsp;that&nbsp;doesn't&nbsp;support&nbsp;PATCH.<br>
208Apply&nbsp;this&nbsp;last&nbsp;if&nbsp;you&nbsp;are&nbsp;using&nbsp;OAuth&nbsp;1.0,&nbsp;as&nbsp;changing&nbsp;the&nbsp;method<br>
209will&nbsp;result&nbsp;in&nbsp;a&nbsp;different&nbsp;signature.</tt></dd></dl>
210</td></tr></table><p>
211<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
Joe Gregorio30dfdc32010-12-09 16:34:22 -0500212<tr bgcolor="#55aa55">
213<td colspan=3 valign=bottom>&nbsp;<br>
214<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
215
216<tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
Joe Gregorio20a5aa92011-04-01 17:44:25 -0400217<td width="100%"><strong>__all__</strong> = ['HttpRequest', 'RequestMockBuilder', 'HttpMockset_user_agent', 'tunnel_patch']<br>
Joe Gregorio30dfdc32010-12-09 16:34:22 -0500218<strong>__author__</strong> = 'jcgregorio@google.com (Joe Gregorio)'</td></tr></table><p>
219<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
220<tr bgcolor="#7799ee">
221<td colspan=3 valign=bottom>&nbsp;<br>
222<font color="#ffffff" face="helvetica, arial"><big><strong>Author</strong></big></font></td></tr>
223
224<tr><td bgcolor="#7799ee"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
225<td width="100%">jcgregorio@google.com&nbsp;(Joe&nbsp;Gregorio)</td></tr></table>
226</body></html>