Skip to content

Commit ebd0b84

Browse files
committed
Refresh docs
1 parent 7ceb26f commit ebd0b84

File tree

138 files changed

+4041
-2548
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+4041
-2548
lines changed

apiclient/discovery.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ def build_from_document(
245245
if model is None:
246246
features = service.get('features', [])
247247
model = JsonModel('dataWrapper' in features)
248-
resource = createResource(http, base, model, requestBuilder, developerKey,
248+
resource = _createResource(http, base, model, requestBuilder, developerKey,
249249
service, service, schema)
250250

251251
return resource
@@ -311,7 +311,7 @@ def _media_size_to_long(maxSize):
311311
return int(maxSize)
312312

313313

314-
def createResource(http, baseUrl, model, requestBuilder,
314+
def _createResource(http, baseUrl, model, requestBuilder,
315315
developerKey, resourceDesc, rootDesc, schema):
316316
"""Build a Resource from the API description.
317317
@@ -707,7 +707,7 @@ def createResourceMethod(theclass, methodName, methodDesc, rootDesc):
707707
methodName = fix_method_name(methodName)
708708

709709
def methodResource(self):
710-
return createResource(self._http, self._baseUrl, self._model,
710+
return _createResource(self._http, self._baseUrl, self._model,
711711
self._requestBuilder, self._developerKey,
712712
methodDesc, rootDesc, schema)
713713

apiclient/http.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,27 @@ def from_json(s, http, postproc):
801801

802802

803803
class BatchHttpRequest(object):
804-
"""Batches multiple HttpRequest objects into a single HTTP request."""
804+
"""Batches multiple HttpRequest objects into a single HTTP request.
805+
806+
Example:
807+
from apiclient.http import BatchHttpRequest
808+
809+
def list_animals(request_id, response):
810+
\"\"\"Do something with the animals list response.\"\"\"
811+
pass
812+
813+
def list_farmers(request_id, response):
814+
\"\"\"Do something with the farmers list response.\"\"\"
815+
pass
816+
817+
service = build('farm', 'v2')
818+
819+
batch = BatchHttpRequest()
820+
821+
batch.add(service.animals().list(), list_animals)
822+
batch.add(service.farmers().list(), list_farmers)
823+
batch.execute(http)
824+
"""
805825

806826
def __init__(self, callback=None, batch_uri=None):
807827
"""Constructor for a BatchHttpRequest.
@@ -1019,13 +1039,13 @@ def add(self, request, callback=None, request_id=None):
10191039
None
10201040
10211041
Raises:
1022-
BatchError if a resumable request is added to a batch.
1042+
BatchError if a media request is added to a batch.
10231043
KeyError is the request_id is not unique.
10241044
"""
10251045
if request_id is None:
10261046
request_id = self._new_id()
10271047
if request.resumable is not None:
1028-
raise BatchError("Resumable requests cannot be used in a batch request.")
1048+
raise BatchError("Media requests cannot be used in a batch request.")
10291049
if request_id in self._requests:
10301050
raise KeyError("A request with this ID already exists: %s" % request_id)
10311051
self._requests[request_id] = request

docs/apiclient.http.html

Lines changed: 120 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949
</font></dt><dt><font face="helvetica, arial"><a href="apiclient.http.html#HttpMockSequence">HttpMockSequence</a>
5050
</font></dt><dt><font face="helvetica, arial"><a href="apiclient.http.html#HttpRequest">HttpRequest</a>
5151
</font></dt><dt><font face="helvetica, arial"><a href="apiclient.http.html#HttpRequestMock">HttpRequestMock</a>
52+
</font></dt><dt><font face="helvetica, arial"><a href="apiclient.http.html#MediaDownloadProgress">MediaDownloadProgress</a>
53+
</font></dt><dt><font face="helvetica, arial"><a href="apiclient.http.html#MediaIoBaseDownload">MediaIoBaseDownload</a>
5254
</font></dt><dt><font face="helvetica, arial"><a href="apiclient.http.html#MediaUpload">MediaUpload</a>
5355
</font></dt><dd>
5456
<dl>
@@ -69,7 +71,26 @@
6971
<font color="#000000" face="helvetica, arial"><a name="BatchHttpRequest">class <strong>BatchHttpRequest</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
7072

7173
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
72-
<td colspan=2><tt>Batches&nbsp;multiple&nbsp;<a href="#HttpRequest">HttpRequest</a>&nbsp;objects&nbsp;into&nbsp;a&nbsp;single&nbsp;HTTP&nbsp;request.<br>&nbsp;</tt></td></tr>
74+
<td colspan=2><tt>Batches&nbsp;multiple&nbsp;<a href="#HttpRequest">HttpRequest</a>&nbsp;objects&nbsp;into&nbsp;a&nbsp;single&nbsp;HTTP&nbsp;request.<br>
75+
&nbsp;<br>
76+
Example:<br>
77+
&nbsp;&nbsp;from&nbsp;apiclient.http&nbsp;import&nbsp;<a href="#BatchHttpRequest">BatchHttpRequest</a><br>
78+
&nbsp;<br>
79+
&nbsp;&nbsp;def&nbsp;list_animals(request_id,&nbsp;response):<br>
80+
&nbsp;&nbsp;&nbsp;&nbsp;"""Do&nbsp;something&nbsp;with&nbsp;the&nbsp;animals&nbsp;list&nbsp;response."""<br>
81+
&nbsp;&nbsp;&nbsp;&nbsp;pass<br>
82+
&nbsp;<br>
83+
&nbsp;&nbsp;def&nbsp;list_farmers(request_id,&nbsp;response):<br>
84+
&nbsp;&nbsp;&nbsp;&nbsp;"""Do&nbsp;something&nbsp;with&nbsp;the&nbsp;farmers&nbsp;list&nbsp;response."""<br>
85+
&nbsp;&nbsp;&nbsp;&nbsp;pass<br>
86+
&nbsp;<br>
87+
&nbsp;&nbsp;service&nbsp;=&nbsp;build('farm',&nbsp;'v2')<br>
88+
&nbsp;<br>
89+
&nbsp;&nbsp;batch&nbsp;=&nbsp;<a href="#BatchHttpRequest">BatchHttpRequest</a>()<br>
90+
&nbsp;<br>
91+
&nbsp;&nbsp;batch.<a href="#BatchHttpRequest-add">add</a>(service.animals().list(),&nbsp;list_animals)<br>
92+
&nbsp;&nbsp;batch.<a href="#BatchHttpRequest-add">add</a>(service.farmers().list(),&nbsp;list_farmers)<br>
93+
&nbsp;&nbsp;batch.<a href="#BatchHttpRequest-execute">execute</a>(http)<br>&nbsp;</tt></td></tr>
7394
<tr><td>&nbsp;</td>
7495
<td width="100%">Methods defined here:<br>
7596
<dl><dt><a name="BatchHttpRequest-__init__"><strong>__init__</strong></a>(self, callback<font color="#909090">=None</font>, batch_uri<font color="#909090">=None</font>)</dt><dd><tt>Constructor&nbsp;for&nbsp;a&nbsp;<a href="#BatchHttpRequest">BatchHttpRequest</a>.<br>
@@ -102,7 +123,7 @@
102123
&nbsp;&nbsp;None<br>
103124
&nbsp;<br>
104125
Raises:<br>
105-
&nbsp;&nbsp;BatchError&nbsp;if&nbsp;a&nbsp;resumable&nbsp;request&nbsp;is&nbsp;added&nbsp;to&nbsp;a&nbsp;batch.<br>
126+
&nbsp;&nbsp;BatchError&nbsp;if&nbsp;a&nbsp;media&nbsp;request&nbsp;is&nbsp;added&nbsp;to&nbsp;a&nbsp;batch.<br>
106127
&nbsp;&nbsp;KeyError&nbsp;is&nbsp;the&nbsp;request_id&nbsp;is&nbsp;not&nbsp;unique.</tt></dd></dl>
107128

108129
<dl><dt><a name="BatchHttpRequest-execute"><strong>execute</strong></a>(self, http<font color="#909090">=None</font>)</dt><dd><tt>Execute&nbsp;all&nbsp;the&nbsp;requests&nbsp;as&nbsp;a&nbsp;single&nbsp;batched&nbsp;HTTP&nbsp;request.<br>
@@ -239,11 +260,11 @@
239260
&nbsp;<br>
240261
Example:<br>
241262
&nbsp;<br>
242-
&nbsp;&nbsp;media&nbsp;=&nbsp;<a href="#MediaFileUpload">MediaFileUpload</a>('smiley.png',&nbsp;mimetype='image/png',<br>
263+
&nbsp;&nbsp;media&nbsp;=&nbsp;<a href="#MediaFileUpload">MediaFileUpload</a>('cow.png',&nbsp;mimetype='image/png',<br>
243264
&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>
244-
&nbsp;&nbsp;request&nbsp;=&nbsp;service.objects().insert(<br>
245-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bucket=buckets['items'][0]['id'],<br>
246-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name='smiley.png',<br>
265+
&nbsp;&nbsp;request&nbsp;=&nbsp;farm.animals().insert(<br>
266+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;id='cow',<br>
267+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name='cow.png',<br>
247268
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;media_body=media)<br>
248269
&nbsp;<br>
249270
&nbsp;&nbsp;response&nbsp;=&nbsp;None<br>
@@ -300,6 +321,36 @@
300321
Same&nbsp;behavior&nbsp;as&nbsp;<a href="#HttpRequest">HttpRequest</a>.<a href="#HttpRequestMock-execute">execute</a>(),&nbsp;but&nbsp;the&nbsp;response&nbsp;is<br>
301322
mocked&nbsp;and&nbsp;not&nbsp;really&nbsp;from&nbsp;an&nbsp;HTTP&nbsp;request/response.</tt></dd></dl>
302323

324+
<hr>
325+
Data descriptors defined here:<br>
326+
<dl><dt><strong>__dict__</strong></dt>
327+
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
328+
</dl>
329+
<dl><dt><strong>__weakref__</strong></dt>
330+
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
331+
</dl>
332+
</td></tr></table> <p>
333+
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
334+
<tr bgcolor="#ffc8d8">
335+
<td colspan=3 valign=bottom>&nbsp;<br>
336+
<font color="#000000" face="helvetica, arial"><a name="MediaDownloadProgress">class <strong>MediaDownloadProgress</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
337+
338+
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
339+
<td colspan=2><tt>Status&nbsp;of&nbsp;a&nbsp;resumable&nbsp;download.<br>&nbsp;</tt></td></tr>
340+
<tr><td>&nbsp;</td>
341+
<td width="100%">Methods defined here:<br>
342+
<dl><dt><a name="MediaDownloadProgress-__init__"><strong>__init__</strong></a>(self, resumable_progress, total_size)</dt><dd><tt>Constructor.<br>
343+
&nbsp;<br>
344+
Args:<br>
345+
&nbsp;&nbsp;resumable_progress:&nbsp;int,&nbsp;bytes&nbsp;received&nbsp;so&nbsp;far.<br>
346+
&nbsp;&nbsp;total_size:&nbsp;int,&nbsp;total&nbsp;bytes&nbsp;in&nbsp;complete&nbsp;download.</tt></dd></dl>
347+
348+
<dl><dt><a name="MediaDownloadProgress-progress"><strong>progress</strong></a>(self)</dt><dd><tt>Percent&nbsp;of&nbsp;download&nbsp;completed,&nbsp;as&nbsp;a&nbsp;float.<br>
349+
&nbsp;<br>
350+
Returns:<br>
351+
&nbsp;&nbsp;the&nbsp;percentage&nbsp;complete&nbsp;as&nbsp;a&nbsp;float,&nbsp;returning&nbsp;0.0&nbsp;if&nbsp;the&nbsp;total&nbsp;size&nbsp;of<br>
352+
&nbsp;&nbsp;the&nbsp;download&nbsp;is&nbsp;unknown.</tt></dd></dl>
353+
303354
<hr>
304355
Data descriptors defined here:<br>
305356
<dl><dt><strong>__dict__</strong></dt>
@@ -321,11 +372,11 @@
321372
method.&nbsp;For&nbsp;example,&nbsp;if&nbsp;we&nbsp;had&nbsp;a&nbsp;service&nbsp;that&nbsp;allowed&nbsp;uploading&nbsp;images:<br>
322373
&nbsp;<br>
323374
&nbsp;<br>
324-
&nbsp;&nbsp;media&nbsp;=&nbsp;<a href="#MediaFileUpload">MediaFileUpload</a>('smiley.png',&nbsp;mimetype='image/png',<br>
375+
&nbsp;&nbsp;media&nbsp;=&nbsp;<a href="#MediaFileUpload">MediaFileUpload</a>('cow.png',&nbsp;mimetype='image/png',<br>
325376
&nbsp;&nbsp;&nbsp;&nbsp;chunksize=1024*1024,&nbsp;resumable=True)<br>
326-
&nbsp;&nbsp;service.objects().insert(<br>
327-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bucket=buckets['items'][0]['id'],<br>
328-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name='smiley.png',<br>
377+
&nbsp;&nbsp;farm.animals()..insert(<br>
378+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;id='cow',<br>
379+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name='cow.png',<br>
329380
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;media_body=media).execute()<br>&nbsp;</tt></td></tr>
330381
<tr><td>&nbsp;</td>
331382
<td width="100%"><dl><dt>Method resolution order:</dt>
@@ -376,7 +427,7 @@
376427
Returns:<br>
377428
&nbsp;&nbsp;Size&nbsp;of&nbsp;the&nbsp;body,&nbsp;or&nbsp;None&nbsp;of&nbsp;the&nbsp;size&nbsp;is&nbsp;unknown.</tt></dd></dl>
378429

379-
<dl><dt><a name="MediaFileUpload-to_json"><strong>to_json</strong></a>(self)</dt><dd><tt>Creating&nbsp;a&nbsp;JSON&nbsp;representation&nbsp;of&nbsp;an&nbsp;instance&nbsp;of&nbsp;Credentials.<br>
430+
<dl><dt><a name="MediaFileUpload-to_json"><strong>to_json</strong></a>(self)</dt><dd><tt>Creating&nbsp;a&nbsp;JSON&nbsp;representation&nbsp;of&nbsp;an&nbsp;instance&nbsp;of&nbsp;<a href="#MediaFileUpload">MediaFileUpload</a>.<br>
380431
&nbsp;<br>
381432
Returns:<br>
382433
&nbsp;&nbsp;&nbsp;string,&nbsp;a&nbsp;JSON&nbsp;representation&nbsp;of&nbsp;this&nbsp;instance,&nbsp;suitable&nbsp;to&nbsp;pass&nbsp;to<br>
@@ -416,7 +467,7 @@
416467
<td colspan=2><tt><a href="#MediaUpload">MediaUpload</a>&nbsp;for&nbsp;a&nbsp;chunk&nbsp;of&nbsp;bytes.<br>
417468
&nbsp;<br>
418469
Construct&nbsp;a&nbsp;<a href="#MediaFileUpload">MediaFileUpload</a>&nbsp;and&nbsp;pass&nbsp;as&nbsp;the&nbsp;media_body&nbsp;parameter&nbsp;of&nbsp;the<br>
419-
method.&nbsp;For&nbsp;example,&nbsp;if&nbsp;we&nbsp;had&nbsp;a&nbsp;service&nbsp;that&nbsp;allowed&nbsp;plain&nbsp;text:<br>&nbsp;</tt></td></tr>
470+
method.<br>&nbsp;</tt></td></tr>
420471
<tr><td>&nbsp;</td>
421472
<td width="100%"><dl><dt>Method resolution order:</dt>
422473
<dd><a href="apiclient.http.html#MediaInMemoryUpload">MediaInMemoryUpload</a></dd>
@@ -500,6 +551,60 @@
500551
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
501552
<tr bgcolor="#ffc8d8">
502553
<td colspan=3 valign=bottom>&nbsp;<br>
554+
<font color="#000000" face="helvetica, arial"><a name="MediaIoBaseDownload">class <strong>MediaIoBaseDownload</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
555+
556+
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
557+
<td colspan=2><tt>"Download&nbsp;media&nbsp;resources.<br>
558+
&nbsp;<br>
559+
Note&nbsp;that&nbsp;the&nbsp;Python&nbsp;file&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;is&nbsp;compatible&nbsp;with&nbsp;io.Base&nbsp;and&nbsp;can&nbsp;be&nbsp;used<br>
560+
with&nbsp;this&nbsp;class&nbsp;also.<br>
561+
&nbsp;<br>
562+
&nbsp;<br>
563+
Example:<br>
564+
&nbsp;&nbsp;request&nbsp;=&nbsp;farms.animals().get_media(id='cow')<br>
565+
&nbsp;&nbsp;fh&nbsp;=&nbsp;io.FileIO('cow.png',&nbsp;mode='wb')<br>
566+
&nbsp;&nbsp;downloader&nbsp;=&nbsp;<a href="#MediaIoBaseDownload">MediaIoBaseDownload</a>(fh,&nbsp;request,&nbsp;chunksize=1024*1024)<br>
567+
&nbsp;<br>
568+
&nbsp;&nbsp;done&nbsp;=&nbsp;False<br>
569+
&nbsp;&nbsp;while&nbsp;done&nbsp;is&nbsp;False:<br>
570+
&nbsp;&nbsp;&nbsp;&nbsp;status,&nbsp;done&nbsp;=&nbsp;downloader.<a href="#MediaIoBaseDownload-next_chunk">next_chunk</a>()<br>
571+
&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;status:<br>
572+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;"Download&nbsp;%d%%."&nbsp;%&nbsp;int(status.progress()&nbsp;*&nbsp;100)<br>
573+
&nbsp;&nbsp;print&nbsp;"Download&nbsp;Complete!"<br>&nbsp;</tt></td></tr>
574+
<tr><td>&nbsp;</td>
575+
<td width="100%">Methods defined here:<br>
576+
<dl><dt><a name="MediaIoBaseDownload-__init__"><strong>__init__</strong></a>(self, fh, request, chunksize<font color="#909090">=524288</font>)</dt><dd><tt>Constructor.<br>
577+
&nbsp;<br>
578+
Args:<br>
579+
&nbsp;&nbsp;fh:&nbsp;io.Base&nbsp;or&nbsp;file&nbsp;<a href="__builtin__.html#object">object</a>,&nbsp;The&nbsp;stream&nbsp;in&nbsp;which&nbsp;to&nbsp;write&nbsp;the&nbsp;downloaded<br>
580+
&nbsp;&nbsp;&nbsp;&nbsp;bytes.<br>
581+
&nbsp;&nbsp;request:&nbsp;apiclient.http.<a href="#HttpRequest">HttpRequest</a>,&nbsp;the&nbsp;media&nbsp;request&nbsp;to&nbsp;perform&nbsp;in<br>
582+
&nbsp;&nbsp;&nbsp;&nbsp;chunks.<br>
583+
&nbsp;&nbsp;chunksize:&nbsp;int,&nbsp;File&nbsp;will&nbsp;be&nbsp;downloaded&nbsp;in&nbsp;chunks&nbsp;of&nbsp;this&nbsp;many&nbsp;bytes.</tt></dd></dl>
584+
585+
<dl><dt><a name="MediaIoBaseDownload-next_chunk"><strong>next_chunk</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;next&nbsp;chunk&nbsp;of&nbsp;the&nbsp;download.<br>
586+
&nbsp;<br>
587+
Returns:<br>
588+
&nbsp;&nbsp;(status,&nbsp;done):&nbsp;(MediaDownloadStatus,&nbsp;boolean)<br>
589+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;value&nbsp;of&nbsp;'done'&nbsp;will&nbsp;be&nbsp;True&nbsp;when&nbsp;the&nbsp;media&nbsp;has&nbsp;been&nbsp;fully<br>
590+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;downloaded.<br>
591+
&nbsp;<br>
592+
Raises:<br>
593+
&nbsp;&nbsp;apiclient.errors.HttpError&nbsp;if&nbsp;the&nbsp;response&nbsp;was&nbsp;not&nbsp;a&nbsp;2xx.<br>
594+
&nbsp;&nbsp;httplib2.Error&nbsp;if&nbsp;a&nbsp;transport&nbsp;error&nbsp;has&nbsp;occured.</tt></dd></dl>
595+
596+
<hr>
597+
Data descriptors defined here:<br>
598+
<dl><dt><strong>__dict__</strong></dt>
599+
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
600+
</dl>
601+
<dl><dt><strong>__weakref__</strong></dt>
602+
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
603+
</dl>
604+
</td></tr></table> <p>
605+
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
606+
<tr bgcolor="#ffc8d8">
607+
<td colspan=3 valign=bottom>&nbsp;<br>
503608
<font color="#000000" face="helvetica, arial"><a name="MediaIoBaseUpload">class <strong>MediaIoBaseUpload</strong></a>(<a href="apiclient.http.html#MediaUpload">MediaUpload</a>)</font></td></tr>
504609

505610
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
@@ -511,9 +616,9 @@
511616
&nbsp;&nbsp;fh&nbsp;=&nbsp;io.BytesIO('...Some&nbsp;data&nbsp;to&nbsp;upload...')<br>
512617
&nbsp;&nbsp;media&nbsp;=&nbsp;<a href="#MediaIoBaseUpload">MediaIoBaseUpload</a>(fh,&nbsp;mimetype='image/png',<br>
513618
&nbsp;&nbsp;&nbsp;&nbsp;chunksize=1024*1024,&nbsp;resumable=True)<br>
514-
&nbsp;&nbsp;service.objects().insert(<br>
515-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bucket='a_bucket_id',<br>
516-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name='smiley.png',<br>
619+
&nbsp;&nbsp;farm.animals().insert(<br>
620+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;id='cow',<br>
621+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name='cow.png',<br>
517622
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;media_body=media).execute()<br>&nbsp;</tt></td></tr>
518623
<tr><td>&nbsp;</td>
519624
<td width="100%"><dl><dt>Method resolution order:</dt>

0 commit comments

Comments
 (0)