forked from googleapis/google-cloud-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgcloud-api.html
More file actions
1126 lines (1041 loc) · 88.8 KB
/
gcloud-api.html
File metadata and controls
1126 lines (1041 loc) · 88.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Shared Core Modules — gcloud 0.10.1 documentation</title>
<link rel="stylesheet" href="_static/css/main.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/normalize.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '0.10.1',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/js/vendor/modernizr-2.6.2.min.js"></script>
<link rel="shortcut icon" href="_static/favicon.ico"/>
<link rel="top" title="gcloud 0.10.1 documentation" href="index.html" />
<link rel="next" title="Authentication" href="gcloud-auth.html" />
<link rel="prev" title="Getting started" href="index.html" />
</head>
<body role="document">
<header class="page-header fixed" role="banner">
<h1 class="logo">
<a href="index.html" title="back to home">
<img src="_static/images/logo.svg" alt="Google Cloud Platform" />
<span class="gcloud">gcloud</span>
</a>
</h1>
<nav class="main-nav">
<div class="nav-current">Python</div>
<ul class="menu">
<li>
<a href="
https://googlecloudplatform.github.io/gcloud-java/" title="gcloud-java page">
<img src="_static/images/icon-lang-java-duke.svg" alt="Duke icon" class="menu-icon" />
Java
</a>
</li>
<li>
<a href="
https://googlecloudplatform.github.io/gcloud-node/#/docs" title="Node.js docs page">
<img src="_static/images/icon-lang-nodejs.svg" alt="Node.js icon" class="menu-icon" />
Node.js
</a>
</li>
<li>
<a href="#" title="Python docs page">
<img src="_static/images/icon-lang-python.svg" alt="Python icon" class="menu-icon" />
Python
</a>
</li>
<li>
<a href="
http://googlecloudplatform.github.io/gcloud-ruby/docs/latest" title="Ruby docs page">
<img src="_static/images/icon-lang-ruby.svg" alt="Ruby icon" class="menu-icon" />
Ruby
</a>
</li>
</ul>
</nav><!-- end of .main-nav -->
<a href="https://github.com/GoogleCloudPlatform/gcloud-python/issues/new?title=%5BDocumentation+Issue%5D+&body=Page+Name%3A+gcloud-api%0ARelease%3A%200.10.1" target="_blank" class="v-btn" id="file-issue">
<img src="_static/images/icon-link-github.svg" />
Report an Issue
</a>
</header><!-- end of .page-header -->
<article class="main lang-page" role="main">
<header class="docs-header">
<div class="versions">
<a href="/gcloud-python/versions.html" class="v-btn">
<img src="_static/images/icon-arrow-bullet.svg" />
Version History (0.10.1)
</a>
</div><!-- end of .versions -->
<div>
<a href="https://github.com/GoogleCloudPlatform/gcloud-python/issues/new?title=%5BDocumentation+Issue%5D+" target="_blank" class="v-btn" id="file-issue-secondary">
<img src="_static/images/icon-link-github.svg" />
Report an Issue
</a>
</div>
</header>
<section class="content">
<div class="section" id="shared-core-modules">
<h1>Shared Core Modules<a class="headerlink" href="#shared-core-modules" title="Permalink to this headline">#</a></h1>
<div class="section" id="module-gcloud.client">
<span id="base-client"></span><h2>Base Client<a class="headerlink" href="#module-gcloud.client" title="Permalink to this headline">#</a></h2>
<p>Base classes for client used to interact with Google Cloud APIs.</p>
<dl class="class">
<dt id="gcloud.client.Client">
<em class="property">class </em><code class="descclassname">gcloud.client.</code><code class="descname">Client</code><span class="sig-paren">(</span><em>credentials=None</em>, <em>http=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/client.html#Client"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.client.Client" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">gcloud.client._ClientFactoryMixin</span></code></p>
<p>Client to bundle configuration needed for API requests.</p>
<p>Assumes that the associated <code class="docutils literal"><span class="pre">_connection_class</span></code> only accepts
<code class="docutils literal"><span class="pre">http</span></code> and <code class="docutils literal"><span class="pre">credentials</span></code> in its constructor.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>credentials</strong> (<a class="reference external" href="http://oauth2client.readthedocs.org/en/latest/source/oauth2client.client.html#oauth2client.client.OAuth2Credentials" title="(in oauth2client v2.0.0.post1)"><code class="xref py py-class docutils literal"><span class="pre">oauth2client.client.OAuth2Credentials</span></code></a> or
<code class="xref py py-class docutils literal"><span class="pre">NoneType</span></code>) – The OAuth2 Credentials to use for the connection
owned by this client. If not passed (and if no <code class="docutils literal"><span class="pre">http</span></code>
object is passed), falls back to the default inferred
from the environment.</li>
<li><strong>http</strong> (<a class="reference external" href="http://bitworking.org/projects/httplib2/doc/html/libhttplib2.html#httplib2.Http" title="(in httplib2 v0.4)"><code class="xref py py-class docutils literal"><span class="pre">httplib2.Http</span></code></a> or class that defines <code class="docutils literal"><span class="pre">request()</span></code>.) – An optional HTTP object to make requests. If not passed, an
<code class="docutils literal"><span class="pre">http</span></code> object is created that is bound to the
<code class="docutils literal"><span class="pre">credentials</span></code> for the current object.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="gcloud.client.Client.from_service_account_json">
<code class="descname">from_service_account_json</code><span class="sig-paren">(</span><em>json_credentials_path</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#gcloud.client.Client.from_service_account_json" title="Permalink to this definition">#</a></dt>
<dd><p>Factory to retrieve JSON credentials while creating client.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>json_credentials_path</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The path to a private key file (this file
was given to you when you created the
service account). This file must contain
a JSON object with a private key and
other credentials information (downloaded
from the Google APIs console).</li>
<li><strong>args</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#tuple" title="(in Python v2.7)"><em>tuple</em></a>) – Remaining positional arguments to pass to constructor.</li>
<li><strong>kwargs</strong> (<a class="reference external" href="https://docs.python.org/library/stdtypes.html#dict" title="(in Python v2.7)"><em>dict</em></a>) – Remaining keyword arguments to pass to constructor.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first"><a class="reference internal" href="pubsub-client.html#gcloud.pubsub.client.Client" title="gcloud.pubsub.client.Client"><code class="xref py py-class docutils literal"><span class="pre">gcloud.pubsub.client.Client</span></code></a></p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The client created with the retrieved JSON credentials.</p>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">TypeError</span></code> if there is a conflict with the kwargs
and the credentials created by the factory.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="gcloud.client.Client.from_service_account_p12">
<code class="descname">from_service_account_p12</code><span class="sig-paren">(</span><em>client_email</em>, <em>private_key_path</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#gcloud.client.Client.from_service_account_p12" title="Permalink to this definition">#</a></dt>
<dd><p>Factory to retrieve P12 credentials while creating client.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Unless you have an explicit reason to use a PKCS12 key for your
service account, we recommend using a JSON key.</p>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>client_email</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The e-mail attached to the service account.</li>
<li><strong>private_key_path</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The path to a private key file (this file was
given to you when you created the service
account). This file must be in P12 format.</li>
<li><strong>args</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#tuple" title="(in Python v2.7)"><em>tuple</em></a>) – Remaining positional arguments to pass to constructor.</li>
<li><strong>kwargs</strong> (<a class="reference external" href="https://docs.python.org/library/stdtypes.html#dict" title="(in Python v2.7)"><em>dict</em></a>) – Remaining keyword arguments to pass to constructor.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first"><a class="reference internal" href="#gcloud.client.Client" title="gcloud.client.Client"><code class="xref py py-class docutils literal"><span class="pre">gcloud.client.Client</span></code></a></p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The client created with the retrieved P12 credentials.</p>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">TypeError</span></code> if there is a conflict with the kwargs
and the credentials created by the factory.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="gcloud.client.JSONClient">
<em class="property">class </em><code class="descclassname">gcloud.client.</code><code class="descname">JSONClient</code><span class="sig-paren">(</span><em>project=None</em>, <em>credentials=None</em>, <em>http=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/client.html#JSONClient"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.client.JSONClient" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <a class="reference internal" href="#gcloud.client.Client" title="gcloud.client.Client"><code class="xref py py-class docutils literal"><span class="pre">gcloud.client.Client</span></code></a>, <code class="xref py py-class docutils literal"><span class="pre">gcloud.client._ClientProjectMixin</span></code></p>
<p>Client to for Google JSON-based API.</p>
<p>Assumes such APIs use the <code class="docutils literal"><span class="pre">project</span></code> and the client needs to store this
value.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>project</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – the project which the client acts on behalf of. If not
passed falls back to the default inferred from the
environment.</li>
<li><strong>credentials</strong> (<a class="reference external" href="http://oauth2client.readthedocs.org/en/latest/source/oauth2client.client.html#oauth2client.client.OAuth2Credentials" title="(in oauth2client v2.0.0.post1)"><code class="xref py py-class docutils literal"><span class="pre">oauth2client.client.OAuth2Credentials</span></code></a> or
<code class="xref py py-class docutils literal"><span class="pre">NoneType</span></code>) – The OAuth2 Credentials to use for the connection
owned by this client. If not passed (and if no <code class="docutils literal"><span class="pre">http</span></code>
object is passed), falls back to the default inferred
from the environment.</li>
<li><strong>http</strong> (<a class="reference external" href="http://bitworking.org/projects/httplib2/doc/html/libhttplib2.html#httplib2.Http" title="(in httplib2 v0.4)"><code class="xref py py-class docutils literal"><span class="pre">httplib2.Http</span></code></a> or class that defines <code class="docutils literal"><span class="pre">request()</span></code>.) – An optional HTTP object to make requests. If not passed, an
<code class="docutils literal"><span class="pre">http</span></code> object is created that is bound to the
<code class="docutils literal"><span class="pre">credentials</span></code> for the current object.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">ValueError</span></code> if the project is neither passed in nor
set in the environment.</p>
</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="gcloud.client.JSONClient.from_service_account_json">
<code class="descname">from_service_account_json</code><span class="sig-paren">(</span><em>json_credentials_path</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#gcloud.client.JSONClient.from_service_account_json" title="Permalink to this definition">#</a></dt>
<dd><p>Factory to retrieve JSON credentials while creating client.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>json_credentials_path</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The path to a private key file (this file
was given to you when you created the
service account). This file must contain
a JSON object with a private key and
other credentials information (downloaded
from the Google APIs console).</li>
<li><strong>args</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#tuple" title="(in Python v2.7)"><em>tuple</em></a>) – Remaining positional arguments to pass to constructor.</li>
<li><strong>kwargs</strong> (<a class="reference external" href="https://docs.python.org/library/stdtypes.html#dict" title="(in Python v2.7)"><em>dict</em></a>) – Remaining keyword arguments to pass to constructor.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first"><a class="reference internal" href="pubsub-client.html#gcloud.pubsub.client.Client" title="gcloud.pubsub.client.Client"><code class="xref py py-class docutils literal"><span class="pre">gcloud.pubsub.client.Client</span></code></a></p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The client created with the retrieved JSON credentials.</p>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">TypeError</span></code> if there is a conflict with the kwargs
and the credentials created by the factory.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="gcloud.client.JSONClient.from_service_account_p12">
<code class="descname">from_service_account_p12</code><span class="sig-paren">(</span><em>client_email</em>, <em>private_key_path</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#gcloud.client.JSONClient.from_service_account_p12" title="Permalink to this definition">#</a></dt>
<dd><p>Factory to retrieve P12 credentials while creating client.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Unless you have an explicit reason to use a PKCS12 key for your
service account, we recommend using a JSON key.</p>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>client_email</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The e-mail attached to the service account.</li>
<li><strong>private_key_path</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The path to a private key file (this file was
given to you when you created the service
account). This file must be in P12 format.</li>
<li><strong>args</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#tuple" title="(in Python v2.7)"><em>tuple</em></a>) – Remaining positional arguments to pass to constructor.</li>
<li><strong>kwargs</strong> (<a class="reference external" href="https://docs.python.org/library/stdtypes.html#dict" title="(in Python v2.7)"><em>dict</em></a>) – Remaining keyword arguments to pass to constructor.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first"><a class="reference internal" href="#gcloud.client.Client" title="gcloud.client.Client"><code class="xref py py-class docutils literal"><span class="pre">gcloud.client.Client</span></code></a></p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The client created with the retrieved P12 credentials.</p>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">TypeError</span></code> if there is a conflict with the kwargs
and the credentials created by the factory.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="module-gcloud.credentials">
<span id="credentials-helpers"></span><h2>Credentials Helpers<a class="headerlink" href="#module-gcloud.credentials" title="Permalink to this headline">#</a></h2>
<p>A simple wrapper around the OAuth2 credentials library.</p>
<dl class="function">
<dt id="gcloud.credentials.generate_signed_url">
<code class="descclassname">gcloud.credentials.</code><code class="descname">generate_signed_url</code><span class="sig-paren">(</span><em>credentials</em>, <em>resource</em>, <em>expiration</em>, <em>api_access_endpoint=''</em>, <em>method='GET'</em>, <em>content_md5=None</em>, <em>content_type=None</em>, <em>response_type=None</em>, <em>response_disposition=None</em>, <em>generation=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/credentials.html#generate_signed_url"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.credentials.generate_signed_url" title="Permalink to this definition">#</a></dt>
<dd><p>Generate signed URL to provide query-string auth’n to a resource.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If you are on Google Compute Engine, you can’t generate a signed URL.
Follow <a class="reference external" href="https://github.com/GoogleCloudPlatform/gcloud-python/issues/922">Issue 922</a> for updates on this. If you’d like to be able to
generate a signed URL from GCE, you can use a standard service account
from a JSON file rather than a GCE service account.</p>
</div>
<p>See headers <a class="reference external" href="https://cloud.google.com/storage/docs/reference-headers">reference</a> for more details on optional arguments.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>credentials</strong> (<code class="xref py py-class docutils literal"><span class="pre">oauth2client.appengine.AppAssertionCredentials</span></code>) – Credentials object with an associated private key to
sign text.</li>
<li><strong>resource</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – A pointer to a specific resource
(typically, <code class="docutils literal"><span class="pre">/bucket-name/path/to/blob.txt</span></code>).</li>
<li><strong>expiration</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>, <a class="reference external" href="https://docs.python.org/library/functions.html#long" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">long</span></code></a>, <a class="reference external" href="https://docs.python.org/library/datetime.html#datetime.datetime" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">datetime.datetime</span></code></a>,
<a class="reference external" href="https://docs.python.org/library/datetime.html#datetime.timedelta" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">datetime.timedelta</span></code></a>) – When the signed URL should expire.</li>
<li><strong>api_access_endpoint</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) – Optional URI base. Defaults to empty string.</li>
<li><strong>method</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) – The HTTP verb that will be used when requesting the URL.
Defaults to <code class="docutils literal"><span class="pre">'GET'</span></code>.</li>
<li><strong>content_md5</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) – (Optional) The MD5 hash of the object referenced by
<code class="docutils literal"><span class="pre">resource</span></code>.</li>
<li><strong>content_type</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) – (Optional) The content type of the object referenced
by <code class="docutils literal"><span class="pre">resource</span></code>.</li>
<li><strong>response_type</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) – (Optional) Content type of responses to requests for
the signed URL. Used to over-ride the content type of
the underlying resource.</li>
<li><strong>response_disposition</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) – (Optional) Content disposition of responses to
requests for the signed URL.</li>
<li><strong>generation</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) – (Optional) A value that indicates which generation of
the resource to fetch.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first"><a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)">string</a></p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A signed URL you can use to access the resource
until expiration.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="gcloud.credentials.get_credentials">
<code class="descclassname">gcloud.credentials.</code><code class="descname">get_credentials</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/credentials.html#get_credentials"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.credentials.get_credentials" title="Permalink to this definition">#</a></dt>
<dd><p>Gets credentials implicitly from the current environment.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">You should not need to use this function directly. Instead, use a
helper method which uses this method under the hood.</p>
</div>
<p>Checks environment in order of precedence:</p>
<ul class="simple">
<li>Google App Engine (production and testing)</li>
<li>Environment variable <span class="target" id="index-0"></span><code class="xref std std-envvar docutils literal"><span class="pre">GOOGLE_APPLICATION_CREDENTIALS</span></code> pointing to
a file with stored credentials information.</li>
<li>Stored “well known” file associated with <code class="docutils literal"><span class="pre">gcloud</span></code> command line tool.</li>
<li>Google Compute Engine production environment.</li>
</ul>
<p>The file referred to in <span class="target" id="index-1"></span><code class="xref std std-envvar docutils literal"><span class="pre">GOOGLE_APPLICATION_CREDENTIALS</span></code> is
expected to contain information about credentials that are ready to use.
This means either service account information or user account information
with a ready-to-use refresh token:</p>
<div class="code json highlight-python"><div class="highlight"><pre><span></span><span class="p">{</span>
<span class="s1">'type'</span><span class="p">:</span> <span class="s1">'authorized_user'</span><span class="p">,</span>
<span class="s1">'client_id'</span><span class="p">:</span> <span class="s1">'...'</span><span class="p">,</span>
<span class="s1">'client_secret'</span><span class="p">:</span> <span class="s1">'...'</span><span class="p">,</span>
<span class="s1">'refresh_token'</span><span class="p">:</span> <span class="s1">'...'</span>
<span class="p">}</span>
</pre></div>
</div>
<p>or</p>
<div class="code json highlight-python"><div class="highlight"><pre><span></span><span class="p">{</span>
<span class="s1">'type'</span><span class="p">:</span> <span class="s1">'service_account'</span><span class="p">,</span>
<span class="s1">'client_id'</span><span class="p">:</span> <span class="s1">'...'</span><span class="p">,</span>
<span class="s1">'client_email'</span><span class="p">:</span> <span class="s1">'...'</span><span class="p">,</span>
<span class="s1">'private_key_id'</span><span class="p">:</span> <span class="s1">'...'</span><span class="p">,</span>
<span class="s1">'private_key'</span><span class="p">:</span> <span class="s1">'...'</span>
<span class="p">}</span>
</pre></div>
</div>
<p>The second of these is simply a JSON key downloaded from the Google APIs
console. The first is a close cousin of the “client secrets” JSON file
used by <a class="reference external" href="http://oauth2client.readthedocs.org/en/latest/source/oauth2client.clientsecrets.html#module-oauth2client.clientsecrets" title="(in oauth2client v2.0.0.post1)"><code class="xref py py-mod docutils literal"><span class="pre">oauth2client.clientsecrets</span></code></a> but differs in formatting.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="http://oauth2client.readthedocs.org/en/latest/source/oauth2client.client.html#oauth2client.client.GoogleCredentials" title="(in oauth2client v2.0.0.post1)"><code class="xref py py-class docutils literal"><span class="pre">oauth2client.client.GoogleCredentials</span></code></a>,
<code class="xref py py-class docutils literal"><span class="pre">oauth2client.contrib.appengine.AppAssertionCredentials</span></code>,
<a class="reference external" href="http://oauth2client.readthedocs.org/en/latest/source/oauth2client.contrib.gce.html#oauth2client.contrib.gce.AppAssertionCredentials" title="(in oauth2client v2.0.0.post1)"><code class="xref py py-class docutils literal"><span class="pre">oauth2client.contrib.gce.AppAssertionCredentials</span></code></a>,
<a class="reference external" href="http://oauth2client.readthedocs.org/en/latest/source/oauth2client.service_account.html#oauth2client.service_account.ServiceAccountCredentials" title="(in oauth2client v2.0.0.post1)"><code class="xref py py-class docutils literal"><span class="pre">oauth2client.service_account.ServiceAccountCredentials</span></code></a></td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">A new credentials instance corresponding to the implicit
environment.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="gcloud.credentials.get_for_service_account_json">
<code class="descclassname">gcloud.credentials.</code><code class="descname">get_for_service_account_json</code><span class="sig-paren">(</span><em>json_credentials_path</em>, <em>scope=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/credentials.html#get_for_service_account_json"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.credentials.get_for_service_account_json" title="Permalink to this definition">#</a></dt>
<dd><p>Gets the credentials for a service account with JSON key.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>json_credentials_path</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The path to a private key file (this file was
given to you when you created the service
account). This file must contain a JSON
object with a private key and other
credentials information (downloaded from the
Google APIs console).</li>
<li><strong>scope</strong> (<em>string or tuple of string</em>) – The scope against which to authenticate. (Different services
require different scopes, check the documentation for which
scope is required for the different levels of access to any
particular API.)</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first"><a class="reference external" href="http://oauth2client.readthedocs.org/en/latest/source/oauth2client.client.html#oauth2client.client.GoogleCredentials" title="(in oauth2client v2.0.0.post1)"><code class="xref py py-class docutils literal"><span class="pre">oauth2client.client.GoogleCredentials</span></code></a>,
<a class="reference external" href="http://oauth2client.readthedocs.org/en/latest/source/oauth2client.service_account.html#oauth2client.service_account.ServiceAccountCredentials" title="(in oauth2client v2.0.0.post1)"><code class="xref py py-class docutils literal"><span class="pre">oauth2client.service_account.ServiceAccountCredentials</span></code></a></p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">New service account or Google (for a user JSON key file)
credentials object.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="gcloud.credentials.get_for_service_account_p12">
<code class="descclassname">gcloud.credentials.</code><code class="descname">get_for_service_account_p12</code><span class="sig-paren">(</span><em>client_email</em>, <em>private_key_path</em>, <em>scope=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/credentials.html#get_for_service_account_p12"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.credentials.get_for_service_account_p12" title="Permalink to this definition">#</a></dt>
<dd><p>Gets the credentials for a service account with PKCS12 / p12 key.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This method is not used by default, instead <a class="reference internal" href="#gcloud.credentials.get_credentials" title="gcloud.credentials.get_credentials"><code class="xref py py-func docutils literal"><span class="pre">get_credentials()</span></code></a>
is used. This method is intended to be used when the environment is
known explicitly and detecting the environment implicitly would be
superfluous.</p>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>client_email</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The e-mail attached to the service account.</li>
<li><strong>private_key_path</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The path to a private key file (this file was
given to you when you created the service
account). This file must be in P12 format.</li>
<li><strong>scope</strong> (<em>string or tuple of string</em>) – The scope against which to authenticate. (Different services
require different scopes, check the documentation for which
scope is required for the different levels of access to any
particular API.)</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first"><a class="reference external" href="http://oauth2client.readthedocs.org/en/latest/source/oauth2client.service_account.html#oauth2client.service_account.ServiceAccountCredentials" title="(in oauth2client v2.0.0.post1)"><code class="xref py py-class docutils literal"><span class="pre">oauth2client.service_account.ServiceAccountCredentials</span></code></a></p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A new <code class="docutils literal"><span class="pre">ServiceAccountCredentials</span></code> instance with the
needed service account settings.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="module-gcloud.connection">
<span id="base-connections"></span><h2>Base Connections<a class="headerlink" href="#module-gcloud.connection" title="Permalink to this headline">#</a></h2>
<p>Shared implementation of connections to API servers.</p>
<dl class="data">
<dt id="gcloud.connection.API_BASE_URL">
<code class="descclassname">gcloud.connection.</code><code class="descname">API_BASE_URL</code><em class="property"> = 'https://www.googleapis.com'</em><a class="headerlink" href="#gcloud.connection.API_BASE_URL" title="Permalink to this definition">#</a></dt>
<dd><p>The base of the API call URL.</p>
</dd></dl>
<dl class="class">
<dt id="gcloud.connection.Connection">
<em class="property">class </em><code class="descclassname">gcloud.connection.</code><code class="descname">Connection</code><span class="sig-paren">(</span><em>credentials=None</em>, <em>http=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/connection.html#Connection"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.connection.Connection" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/library/functions.html#object" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">object</span></code></a></p>
<p>A generic connection to Google Cloud Platform.</p>
<p>Subclasses should understand only the basic types in method arguments,
however they should be capable of returning advanced types.</p>
<p>If no value is passed in for <code class="docutils literal"><span class="pre">http</span></code>, a <a class="reference external" href="http://bitworking.org/projects/httplib2/doc/html/libhttplib2.html#httplib2.Http" title="(in httplib2 v0.4)"><code class="xref py py-class docutils literal"><span class="pre">httplib2.Http</span></code></a> object
will be created and authorized with the <code class="docutils literal"><span class="pre">credentials</span></code>. If not, the
<code class="docutils literal"><span class="pre">credentials</span></code> and <code class="docutils literal"><span class="pre">http</span></code> need not be related.</p>
<p>Subclasses may seek to use the private key from <code class="docutils literal"><span class="pre">credentials</span></code> to sign
data.</p>
<p>A custom (non-<code class="docutils literal"><span class="pre">httplib2</span></code>) HTTP object must have a <code class="docutils literal"><span class="pre">request</span></code> method
which accepts the following arguments:</p>
<ul class="simple">
<li><code class="docutils literal"><span class="pre">uri</span></code></li>
<li><code class="docutils literal"><span class="pre">method</span></code></li>
<li><code class="docutils literal"><span class="pre">body</span></code></li>
<li><code class="docutils literal"><span class="pre">headers</span></code></li>
</ul>
<p>In addition, <code class="docutils literal"><span class="pre">redirections</span></code> and <code class="docutils literal"><span class="pre">connection_type</span></code> may be used.</p>
<p>Without the use of <code class="docutils literal"><span class="pre">credentials.authorize(http)</span></code>, a custom <code class="docutils literal"><span class="pre">http</span></code>
object will also need to be able to add a bearer token to API
requests and handle token refresh on 401 errors.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>credentials</strong> (<a class="reference external" href="http://oauth2client.readthedocs.org/en/latest/source/oauth2client.client.html#oauth2client.client.OAuth2Credentials" title="(in oauth2client v2.0.0.post1)"><code class="xref py py-class docutils literal"><span class="pre">oauth2client.client.OAuth2Credentials</span></code></a> or
<code class="xref py py-class docutils literal"><span class="pre">NoneType</span></code>) – The OAuth2 Credentials to use for this connection.</li>
<li><strong>http</strong> (<a class="reference external" href="http://bitworking.org/projects/httplib2/doc/html/libhttplib2.html#httplib2.Http" title="(in httplib2 v0.4)"><code class="xref py py-class docutils literal"><span class="pre">httplib2.Http</span></code></a> or class that defines <code class="docutils literal"><span class="pre">request()</span></code>.) – An optional HTTP object to make requests.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="attribute">
<dt id="gcloud.connection.Connection.SCOPE">
<code class="descname">SCOPE</code><em class="property"> = None</em><a class="headerlink" href="#gcloud.connection.Connection.SCOPE" title="Permalink to this definition">#</a></dt>
<dd><p>The scopes required for authenticating with a service.</p>
<p>Needs to be set by subclasses.</p>
</dd></dl>
<dl class="attribute">
<dt id="gcloud.connection.Connection.USER_AGENT">
<code class="descname">USER_AGENT</code><em class="property"> = 'gcloud-python/0.10.1'</em><a class="headerlink" href="#gcloud.connection.Connection.USER_AGENT" title="Permalink to this definition">#</a></dt>
<dd><p>The user agent for gcloud-python requests.</p>
</dd></dl>
<dl class="attribute">
<dt id="gcloud.connection.Connection.credentials">
<code class="descname">credentials</code><a class="headerlink" href="#gcloud.connection.Connection.credentials" title="Permalink to this definition">#</a></dt>
<dd><p>Getter for current credentials.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="http://oauth2client.readthedocs.org/en/latest/source/oauth2client.client.html#oauth2client.client.OAuth2Credentials" title="(in oauth2client v2.0.0.post1)"><code class="xref py py-class docutils literal"><span class="pre">oauth2client.client.OAuth2Credentials</span></code></a> or
<code class="xref py py-class docutils literal"><span class="pre">NoneType</span></code></td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">The credentials object associated with this connection.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="gcloud.connection.Connection.http">
<code class="descname">http</code><a class="headerlink" href="#gcloud.connection.Connection.http" title="Permalink to this definition">#</a></dt>
<dd><p>A getter for the HTTP transport used in talking to the API.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="http://bitworking.org/projects/httplib2/doc/html/libhttplib2.html#httplib2.Http" title="(in httplib2 v0.4)"><code class="xref py py-class docutils literal"><span class="pre">httplib2.Http</span></code></a></td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">A Http object used to transport data.</td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="gcloud.connection.JSONConnection">
<em class="property">class </em><code class="descclassname">gcloud.connection.</code><code class="descname">JSONConnection</code><span class="sig-paren">(</span><em>credentials=None</em>, <em>http=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/connection.html#JSONConnection"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.connection.JSONConnection" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <a class="reference internal" href="#gcloud.connection.Connection" title="gcloud.connection.Connection"><code class="xref py py-class docutils literal"><span class="pre">gcloud.connection.Connection</span></code></a></p>
<p>A connection to a Google JSON-based API.</p>
<p>These APIs are discovery based. For reference:</p>
<blockquote>
<div><a class="reference external" href="https://developers.google.com/discovery/">https://developers.google.com/discovery/</a></div></blockquote>
<p>This defines <a class="reference internal" href="#gcloud.connection.JSONConnection.api_request" title="gcloud.connection.JSONConnection.api_request"><code class="xref py py-meth docutils literal"><span class="pre">api_request()</span></code></a> for making a generic JSON
API request and API requests are created elsewhere.</p>
<p>The class constants</p>
<ul class="simple">
<li><a class="reference internal" href="#gcloud.connection.API_BASE_URL" title="gcloud.connection.API_BASE_URL"><code class="xref py py-attr docutils literal"><span class="pre">API_BASE_URL</span></code></a></li>
<li><a class="reference internal" href="#gcloud.connection.JSONConnection.API_VERSION" title="gcloud.connection.JSONConnection.API_VERSION"><code class="xref py py-attr docutils literal"><span class="pre">API_VERSION</span></code></a></li>
<li><a class="reference internal" href="#gcloud.connection.JSONConnection.API_URL_TEMPLATE" title="gcloud.connection.JSONConnection.API_URL_TEMPLATE"><code class="xref py py-attr docutils literal"><span class="pre">API_URL_TEMPLATE</span></code></a></li>
</ul>
<p>must be updated by subclasses.</p>
<dl class="attribute">
<dt id="gcloud.connection.JSONConnection.API_BASE_URL">
<code class="descname">API_BASE_URL</code><em class="property"> = None</em><a class="headerlink" href="#gcloud.connection.JSONConnection.API_BASE_URL" title="Permalink to this definition">#</a></dt>
<dd><p>The base of the API call URL.</p>
</dd></dl>
<dl class="attribute">
<dt id="gcloud.connection.JSONConnection.API_URL_TEMPLATE">
<code class="descname">API_URL_TEMPLATE</code><em class="property"> = None</em><a class="headerlink" href="#gcloud.connection.JSONConnection.API_URL_TEMPLATE" title="Permalink to this definition">#</a></dt>
<dd><p>A template for the URL of a particular API call.</p>
</dd></dl>
<dl class="attribute">
<dt id="gcloud.connection.JSONConnection.API_VERSION">
<code class="descname">API_VERSION</code><em class="property"> = None</em><a class="headerlink" href="#gcloud.connection.JSONConnection.API_VERSION" title="Permalink to this definition">#</a></dt>
<dd><p>The version of the API, used in building the API call’s URL.</p>
</dd></dl>
<dl class="method">
<dt id="gcloud.connection.JSONConnection.api_request">
<code class="descname">api_request</code><span class="sig-paren">(</span><em>method</em>, <em>path</em>, <em>query_params=None</em>, <em>data=None</em>, <em>content_type=None</em>, <em>api_base_url=None</em>, <em>api_version=None</em>, <em>expect_json=True</em>, <em>_target_object=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/connection.html#JSONConnection.api_request"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.connection.JSONConnection.api_request" title="Permalink to this definition">#</a></dt>
<dd><p>Make a request over the HTTP transport to the API.</p>
<p>You shouldn’t need to use this method, but if you plan to
interact with the API using these primitives, this is the
correct one to use.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>method</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The HTTP method name (ie, <code class="docutils literal"><span class="pre">GET</span></code>, <code class="docutils literal"><span class="pre">POST</span></code>, etc).
Required.</li>
<li><strong>path</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The path to the resource (ie, <code class="docutils literal"><span class="pre">'/b/bucket-name'</span></code>).
Required.</li>
<li><strong>query_params</strong> (<a class="reference external" href="https://docs.python.org/library/stdtypes.html#dict" title="(in Python v2.7)"><em>dict</em></a>) – A dictionary of keys and values to insert into
the query string of the URL. Default is
empty dict.</li>
<li><strong>data</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The data to send as the body of the request. Default is
the empty string.</li>
<li><strong>content_type</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The proper MIME type of the data provided. Default
is None.</li>
<li><strong>api_base_url</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The base URL for the API endpoint.
Typically you won’t have to provide this.
Default is the standard API base URL.</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The version of the API to call. Typically
you shouldn’t provide this and instead use
the default for the library. Default is the
latest API version supported by
gcloud-python.</li>
<li><strong>expect_json</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#bool" title="(in Python v2.7)"><em>bool</em></a>) – If True, this method will try to parse the
response as JSON and raise an exception if
that cannot be done. Default is True.</li>
<li><strong>_target_object</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#object" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">object</span></code></a> or <code class="xref py py-class docutils literal"><span class="pre">NoneType</span></code>) – Protected argument to be used by library
callers. This can allow custom behavior, for
example, to defer an HTTP request and complete
initialization of the object at a later time.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last">Exception if the response code is not 200 OK.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="classmethod">
<dt id="gcloud.connection.JSONConnection.build_api_url">
<em class="property">classmethod </em><code class="descname">build_api_url</code><span class="sig-paren">(</span><em>path</em>, <em>query_params=None</em>, <em>api_base_url=None</em>, <em>api_version=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/connection.html#JSONConnection.build_api_url"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.connection.JSONConnection.build_api_url" title="Permalink to this definition">#</a></dt>
<dd><p>Construct an API url given a few components, some optional.</p>
<p>Typically, you shouldn’t need to use this method.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>path</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The path to the resource (ie, <code class="docutils literal"><span class="pre">'/b/bucket-name'</span></code>).</li>
<li><strong>query_params</strong> (<a class="reference external" href="https://docs.python.org/library/stdtypes.html#dict" title="(in Python v2.7)"><em>dict</em></a>) – A dictionary of keys and values to insert into
the query string of the URL.</li>
<li><strong>api_base_url</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The base URL for the API endpoint.
Typically you won’t have to provide this.</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The version of the API to call.
Typically you shouldn’t provide this and instead
use the default for the library.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first"><a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)">string</a></p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">The URL assembled from the pieces provided.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="module-gcloud.exceptions">
<span id="exceptions"></span><h2>Exceptions<a class="headerlink" href="#module-gcloud.exceptions" title="Permalink to this headline">#</a></h2>
<p>Custom exceptions for <code class="xref py py-mod docutils literal"><span class="pre">gcloud</span></code> package.</p>
<p>See: <a class="reference external" href="https://cloud.google.com/storage/docs/json_api/v1/status-codes">https://cloud.google.com/storage/docs/json_api/v1/status-codes</a></p>
<dl class="exception">
<dt id="gcloud.exceptions.BadRequest">
<em class="property">exception </em><code class="descclassname">gcloud.exceptions.</code><code class="descname">BadRequest</code><span class="sig-paren">(</span><em>message</em>, <em>errors=()</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/exceptions.html#BadRequest"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.exceptions.BadRequest" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <a class="reference internal" href="#gcloud.exceptions.ClientError" title="gcloud.exceptions.ClientError"><code class="xref py py-class docutils literal"><span class="pre">gcloud.exceptions.ClientError</span></code></a></p>
<p>Exception mapping a ‘400 Bad Request’ response.</p>
<dl class="attribute">
<dt id="gcloud.exceptions.BadRequest.code">
<code class="descname">code</code><em class="property"> = 400</em><a class="headerlink" href="#gcloud.exceptions.BadRequest.code" title="Permalink to this definition">#</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="exception">
<dt id="gcloud.exceptions.ClientError">
<em class="property">exception </em><code class="descclassname">gcloud.exceptions.</code><code class="descname">ClientError</code><span class="sig-paren">(</span><em>message</em>, <em>errors=()</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/exceptions.html#ClientError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.exceptions.ClientError" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <a class="reference internal" href="#gcloud.exceptions.GCloudError" title="gcloud.exceptions.GCloudError"><code class="xref py py-class docutils literal"><span class="pre">gcloud.exceptions.GCloudError</span></code></a></p>
<p>Base for 4xx responses</p>
<p>This class is abstract</p>
</dd></dl>
<dl class="exception">
<dt id="gcloud.exceptions.Conflict">
<em class="property">exception </em><code class="descclassname">gcloud.exceptions.</code><code class="descname">Conflict</code><span class="sig-paren">(</span><em>message</em>, <em>errors=()</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/exceptions.html#Conflict"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.exceptions.Conflict" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <a class="reference internal" href="#gcloud.exceptions.ClientError" title="gcloud.exceptions.ClientError"><code class="xref py py-class docutils literal"><span class="pre">gcloud.exceptions.ClientError</span></code></a></p>
<p>Exception mapping a ‘409 Conflict’ response.</p>
<dl class="attribute">
<dt id="gcloud.exceptions.Conflict.code">
<code class="descname">code</code><em class="property"> = 409</em><a class="headerlink" href="#gcloud.exceptions.Conflict.code" title="Permalink to this definition">#</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="exception">
<dt id="gcloud.exceptions.Forbidden">
<em class="property">exception </em><code class="descclassname">gcloud.exceptions.</code><code class="descname">Forbidden</code><span class="sig-paren">(</span><em>message</em>, <em>errors=()</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/exceptions.html#Forbidden"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.exceptions.Forbidden" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <a class="reference internal" href="#gcloud.exceptions.ClientError" title="gcloud.exceptions.ClientError"><code class="xref py py-class docutils literal"><span class="pre">gcloud.exceptions.ClientError</span></code></a></p>
<p>Exception mapping a ‘403 Forbidden’ response.</p>
<dl class="attribute">
<dt id="gcloud.exceptions.Forbidden.code">
<code class="descname">code</code><em class="property"> = 403</em><a class="headerlink" href="#gcloud.exceptions.Forbidden.code" title="Permalink to this definition">#</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="exception">
<dt id="gcloud.exceptions.GCloudError">
<em class="property">exception </em><code class="descclassname">gcloud.exceptions.</code><code class="descname">GCloudError</code><span class="sig-paren">(</span><em>message</em>, <em>errors=()</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/exceptions.html#GCloudError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.exceptions.GCloudError" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/library/exceptions.html#exceptions.Exception" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">exceptions.Exception</span></code></a></p>
<p>Base error class for gcloud errors (abstract).</p>
<p>Each subclass represents a single type of HTTP error response.</p>
<dl class="attribute">
<dt id="gcloud.exceptions.GCloudError.code">
<code class="descname">code</code><em class="property"> = None</em><a class="headerlink" href="#gcloud.exceptions.GCloudError.code" title="Permalink to this definition">#</a></dt>
<dd><p>HTTP status code. Concrete subclasses <em>must</em> define.</p>
<p>See: <a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html">http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html</a></p>
</dd></dl>
<dl class="attribute">
<dt id="gcloud.exceptions.GCloudError.errors">
<code class="descname">errors</code><a class="headerlink" href="#gcloud.exceptions.GCloudError.errors" title="Permalink to this definition">#</a></dt>
<dd><p>Detailed error information.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">list(dict)</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">a list of mappings describing each error.</td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
<dl class="exception">
<dt id="gcloud.exceptions.InternalServerError">
<em class="property">exception </em><code class="descclassname">gcloud.exceptions.</code><code class="descname">InternalServerError</code><span class="sig-paren">(</span><em>message</em>, <em>errors=()</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/exceptions.html#InternalServerError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.exceptions.InternalServerError" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <a class="reference internal" href="#gcloud.exceptions.ServerError" title="gcloud.exceptions.ServerError"><code class="xref py py-class docutils literal"><span class="pre">gcloud.exceptions.ServerError</span></code></a></p>
<p>Exception mapping a ‘500 Internal Server Error’ response.</p>
<dl class="attribute">
<dt id="gcloud.exceptions.InternalServerError.code">
<code class="descname">code</code><em class="property"> = 500</em><a class="headerlink" href="#gcloud.exceptions.InternalServerError.code" title="Permalink to this definition">#</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="exception">
<dt id="gcloud.exceptions.LengthRequired">
<em class="property">exception </em><code class="descclassname">gcloud.exceptions.</code><code class="descname">LengthRequired</code><span class="sig-paren">(</span><em>message</em>, <em>errors=()</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/exceptions.html#LengthRequired"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.exceptions.LengthRequired" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <a class="reference internal" href="#gcloud.exceptions.ClientError" title="gcloud.exceptions.ClientError"><code class="xref py py-class docutils literal"><span class="pre">gcloud.exceptions.ClientError</span></code></a></p>
<p>Exception mapping a ‘411 Length Required’ response.</p>
<dl class="attribute">
<dt id="gcloud.exceptions.LengthRequired.code">
<code class="descname">code</code><em class="property"> = 411</em><a class="headerlink" href="#gcloud.exceptions.LengthRequired.code" title="Permalink to this definition">#</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="exception">
<dt id="gcloud.exceptions.MethodNotAllowed">
<em class="property">exception </em><code class="descclassname">gcloud.exceptions.</code><code class="descname">MethodNotAllowed</code><span class="sig-paren">(</span><em>message</em>, <em>errors=()</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/exceptions.html#MethodNotAllowed"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.exceptions.MethodNotAllowed" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <a class="reference internal" href="#gcloud.exceptions.ClientError" title="gcloud.exceptions.ClientError"><code class="xref py py-class docutils literal"><span class="pre">gcloud.exceptions.ClientError</span></code></a></p>
<p>Exception mapping a ‘405 Method Not Allowed’ response.</p>
<dl class="attribute">
<dt id="gcloud.exceptions.MethodNotAllowed.code">
<code class="descname">code</code><em class="property"> = 405</em><a class="headerlink" href="#gcloud.exceptions.MethodNotAllowed.code" title="Permalink to this definition">#</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="exception">
<dt id="gcloud.exceptions.MovedPermanently">
<em class="property">exception </em><code class="descclassname">gcloud.exceptions.</code><code class="descname">MovedPermanently</code><span class="sig-paren">(</span><em>message</em>, <em>errors=()</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/exceptions.html#MovedPermanently"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.exceptions.MovedPermanently" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <a class="reference internal" href="#gcloud.exceptions.Redirection" title="gcloud.exceptions.Redirection"><code class="xref py py-class docutils literal"><span class="pre">gcloud.exceptions.Redirection</span></code></a></p>
<p>Exception mapping a ‘301 Moved Permanently’ response.</p>
<dl class="attribute">
<dt id="gcloud.exceptions.MovedPermanently.code">
<code class="descname">code</code><em class="property"> = 301</em><a class="headerlink" href="#gcloud.exceptions.MovedPermanently.code" title="Permalink to this definition">#</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="exception">
<dt id="gcloud.exceptions.NotFound">
<em class="property">exception </em><code class="descclassname">gcloud.exceptions.</code><code class="descname">NotFound</code><span class="sig-paren">(</span><em>message</em>, <em>errors=()</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/exceptions.html#NotFound"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.exceptions.NotFound" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <a class="reference internal" href="#gcloud.exceptions.ClientError" title="gcloud.exceptions.ClientError"><code class="xref py py-class docutils literal"><span class="pre">gcloud.exceptions.ClientError</span></code></a></p>
<p>Exception mapping a ‘404 Not Found’ response.</p>
<dl class="attribute">
<dt id="gcloud.exceptions.NotFound.code">
<code class="descname">code</code><em class="property"> = 404</em><a class="headerlink" href="#gcloud.exceptions.NotFound.code" title="Permalink to this definition">#</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="exception">
<dt id="gcloud.exceptions.NotImplemented">
<em class="property">exception </em><code class="descclassname">gcloud.exceptions.</code><code class="descname">NotImplemented</code><span class="sig-paren">(</span><em>message</em>, <em>errors=()</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/exceptions.html#NotImplemented"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.exceptions.NotImplemented" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <a class="reference internal" href="#gcloud.exceptions.ServerError" title="gcloud.exceptions.ServerError"><code class="xref py py-class docutils literal"><span class="pre">gcloud.exceptions.ServerError</span></code></a></p>
<p>Exception mapping a ‘501 Not Implemented’ response.</p>
<dl class="attribute">
<dt id="gcloud.exceptions.NotImplemented.code">
<code class="descname">code</code><em class="property"> = 501</em><a class="headerlink" href="#gcloud.exceptions.NotImplemented.code" title="Permalink to this definition">#</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="exception">
<dt id="gcloud.exceptions.NotModified">
<em class="property">exception </em><code class="descclassname">gcloud.exceptions.</code><code class="descname">NotModified</code><span class="sig-paren">(</span><em>message</em>, <em>errors=()</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/exceptions.html#NotModified"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.exceptions.NotModified" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <a class="reference internal" href="#gcloud.exceptions.Redirection" title="gcloud.exceptions.Redirection"><code class="xref py py-class docutils literal"><span class="pre">gcloud.exceptions.Redirection</span></code></a></p>
<p>Exception mapping a ‘304 Not Modified’ response.</p>
<dl class="attribute">
<dt id="gcloud.exceptions.NotModified.code">
<code class="descname">code</code><em class="property"> = 304</em><a class="headerlink" href="#gcloud.exceptions.NotModified.code" title="Permalink to this definition">#</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="exception">
<dt id="gcloud.exceptions.PreconditionFailed">
<em class="property">exception </em><code class="descclassname">gcloud.exceptions.</code><code class="descname">PreconditionFailed</code><span class="sig-paren">(</span><em>message</em>, <em>errors=()</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/exceptions.html#PreconditionFailed"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.exceptions.PreconditionFailed" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <a class="reference internal" href="#gcloud.exceptions.ClientError" title="gcloud.exceptions.ClientError"><code class="xref py py-class docutils literal"><span class="pre">gcloud.exceptions.ClientError</span></code></a></p>
<p>Exception mapping a ‘412 Precondition Failed’ response.</p>
<dl class="attribute">
<dt id="gcloud.exceptions.PreconditionFailed.code">
<code class="descname">code</code><em class="property"> = 412</em><a class="headerlink" href="#gcloud.exceptions.PreconditionFailed.code" title="Permalink to this definition">#</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="exception">
<dt id="gcloud.exceptions.Redirection">
<em class="property">exception </em><code class="descclassname">gcloud.exceptions.</code><code class="descname">Redirection</code><span class="sig-paren">(</span><em>message</em>, <em>errors=()</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/exceptions.html#Redirection"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.exceptions.Redirection" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <a class="reference internal" href="#gcloud.exceptions.GCloudError" title="gcloud.exceptions.GCloudError"><code class="xref py py-class docutils literal"><span class="pre">gcloud.exceptions.GCloudError</span></code></a></p>
<p>Base for 3xx responses</p>
<p>This class is abstract.</p>
</dd></dl>
<dl class="exception">
<dt id="gcloud.exceptions.RequestRangeNotSatisfiable">
<em class="property">exception </em><code class="descclassname">gcloud.exceptions.</code><code class="descname">RequestRangeNotSatisfiable</code><span class="sig-paren">(</span><em>message</em>, <em>errors=()</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/exceptions.html#RequestRangeNotSatisfiable"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.exceptions.RequestRangeNotSatisfiable" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <a class="reference internal" href="#gcloud.exceptions.ClientError" title="gcloud.exceptions.ClientError"><code class="xref py py-class docutils literal"><span class="pre">gcloud.exceptions.ClientError</span></code></a></p>
<p>Exception mapping a ‘416 Request Range Not Satisfiable’ response.</p>
<dl class="attribute">
<dt id="gcloud.exceptions.RequestRangeNotSatisfiable.code">
<code class="descname">code</code><em class="property"> = 416</em><a class="headerlink" href="#gcloud.exceptions.RequestRangeNotSatisfiable.code" title="Permalink to this definition">#</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="exception">
<dt id="gcloud.exceptions.ResumeIncomplete">
<em class="property">exception </em><code class="descclassname">gcloud.exceptions.</code><code class="descname">ResumeIncomplete</code><span class="sig-paren">(</span><em>message</em>, <em>errors=()</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/exceptions.html#ResumeIncomplete"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.exceptions.ResumeIncomplete" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <a class="reference internal" href="#gcloud.exceptions.Redirection" title="gcloud.exceptions.Redirection"><code class="xref py py-class docutils literal"><span class="pre">gcloud.exceptions.Redirection</span></code></a></p>
<p>Exception mapping a ‘308 Resume Incomplete’ response.</p>
<dl class="attribute">
<dt id="gcloud.exceptions.ResumeIncomplete.code">
<code class="descname">code</code><em class="property"> = 308</em><a class="headerlink" href="#gcloud.exceptions.ResumeIncomplete.code" title="Permalink to this definition">#</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="exception">
<dt id="gcloud.exceptions.ServerError">
<em class="property">exception </em><code class="descclassname">gcloud.exceptions.</code><code class="descname">ServerError</code><span class="sig-paren">(</span><em>message</em>, <em>errors=()</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/exceptions.html#ServerError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.exceptions.ServerError" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <a class="reference internal" href="#gcloud.exceptions.GCloudError" title="gcloud.exceptions.GCloudError"><code class="xref py py-class docutils literal"><span class="pre">gcloud.exceptions.GCloudError</span></code></a></p>
<p>Base for 5xx responses: (abstract)</p>
</dd></dl>
<dl class="exception">
<dt id="gcloud.exceptions.ServiceUnavailable">
<em class="property">exception </em><code class="descclassname">gcloud.exceptions.</code><code class="descname">ServiceUnavailable</code><span class="sig-paren">(</span><em>message</em>, <em>errors=()</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/exceptions.html#ServiceUnavailable"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.exceptions.ServiceUnavailable" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <a class="reference internal" href="#gcloud.exceptions.ServerError" title="gcloud.exceptions.ServerError"><code class="xref py py-class docutils literal"><span class="pre">gcloud.exceptions.ServerError</span></code></a></p>
<p>Exception mapping a ‘503 Service Unavailable’ response.</p>
<dl class="attribute">
<dt id="gcloud.exceptions.ServiceUnavailable.code">
<code class="descname">code</code><em class="property"> = 503</em><a class="headerlink" href="#gcloud.exceptions.ServiceUnavailable.code" title="Permalink to this definition">#</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="exception">
<dt id="gcloud.exceptions.TemporaryRedirect">
<em class="property">exception </em><code class="descclassname">gcloud.exceptions.</code><code class="descname">TemporaryRedirect</code><span class="sig-paren">(</span><em>message</em>, <em>errors=()</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/exceptions.html#TemporaryRedirect"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.exceptions.TemporaryRedirect" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <a class="reference internal" href="#gcloud.exceptions.Redirection" title="gcloud.exceptions.Redirection"><code class="xref py py-class docutils literal"><span class="pre">gcloud.exceptions.Redirection</span></code></a></p>
<p>Exception mapping a ‘307 Temporary Redirect’ response.</p>
<dl class="attribute">
<dt id="gcloud.exceptions.TemporaryRedirect.code">
<code class="descname">code</code><em class="property"> = 307</em><a class="headerlink" href="#gcloud.exceptions.TemporaryRedirect.code" title="Permalink to this definition">#</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="exception">
<dt id="gcloud.exceptions.TooManyRequests">
<em class="property">exception </em><code class="descclassname">gcloud.exceptions.</code><code class="descname">TooManyRequests</code><span class="sig-paren">(</span><em>message</em>, <em>errors=()</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/exceptions.html#TooManyRequests"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.exceptions.TooManyRequests" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <a class="reference internal" href="#gcloud.exceptions.ClientError" title="gcloud.exceptions.ClientError"><code class="xref py py-class docutils literal"><span class="pre">gcloud.exceptions.ClientError</span></code></a></p>
<p>Exception mapping a ‘429 Too Many Requests’ response.</p>
<dl class="attribute">
<dt id="gcloud.exceptions.TooManyRequests.code">
<code class="descname">code</code><em class="property"> = 429</em><a class="headerlink" href="#gcloud.exceptions.TooManyRequests.code" title="Permalink to this definition">#</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="exception">
<dt id="gcloud.exceptions.Unauthorized">
<em class="property">exception </em><code class="descclassname">gcloud.exceptions.</code><code class="descname">Unauthorized</code><span class="sig-paren">(</span><em>message</em>, <em>errors=()</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/exceptions.html#Unauthorized"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.exceptions.Unauthorized" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <a class="reference internal" href="#gcloud.exceptions.ClientError" title="gcloud.exceptions.ClientError"><code class="xref py py-class docutils literal"><span class="pre">gcloud.exceptions.ClientError</span></code></a></p>
<p>Exception mapping a ‘401 Unauthorized’ response.</p>
<dl class="attribute">
<dt id="gcloud.exceptions.Unauthorized.code">
<code class="descname">code</code><em class="property"> = 401</em><a class="headerlink" href="#gcloud.exceptions.Unauthorized.code" title="Permalink to this definition">#</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="function">
<dt id="gcloud.exceptions.make_exception">
<code class="descclassname">gcloud.exceptions.</code><code class="descname">make_exception</code><span class="sig-paren">(</span><em>response</em>, <em>content</em>, <em>error_info=None</em>, <em>use_json=True</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/exceptions.html#make_exception"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.exceptions.make_exception" title="Permalink to this definition">#</a></dt>
<dd><p>Factory: create exception based on HTTP response code.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>response</strong> (<a class="reference external" href="http://bitworking.org/projects/httplib2/doc/html/libhttplib2.html#httplib2.Response" title="(in httplib2 v0.4)"><code class="xref py py-class docutils literal"><span class="pre">httplib2.Response</span></code></a> or other HTTP response object) – A response object that defines a status code as the
status attribute.</li>
<li><strong>content</strong> (<em>string or dictionary</em>) – The body of the HTTP error response.</li>
<li><strong>error_info</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – Optional string giving extra information about the
failed request.</li>
<li><strong>use_json</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#bool" title="(in Python v2.7)"><em>bool</em></a>) – Flag indicating if <code class="docutils literal"><span class="pre">content</span></code> is expected to be JSON.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first">instance of <a class="reference internal" href="#gcloud.exceptions.GCloudError" title="gcloud.exceptions.GCloudError"><code class="xref py py-class docutils literal"><span class="pre">GCloudError</span></code></a>, or a concrete subclass.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">Exception specific to the error response.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="module-gcloud.environment_vars">
<span id="environment-variables"></span><h2>Environment Variables<a class="headerlink" href="#module-gcloud.environment_vars" title="Permalink to this headline">#</a></h2>
<p>Comprehensive list of environment variables used in gcloud.</p>
<p>These enable many types of implicit behavior in both production
and tests.</p>
<dl class="data">
<dt id="gcloud.environment_vars.CREDENTIALS">
<code class="descclassname">gcloud.environment_vars.</code><code class="descname">CREDENTIALS</code><em class="property"> = 'GOOGLE_APPLICATION_CREDENTIALS'</em><a class="headerlink" href="#gcloud.environment_vars.CREDENTIALS" title="Permalink to this definition">#</a></dt>
<dd><p>Environment variable defining location of Google credentials.</p>
</dd></dl>