This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gdata.gauth.html
1210 lines (1133 loc) · 108 KB
/
gdata.gauth.html
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 PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module gdata.gauth</title>
</head><body bgcolor="#f0f0f8">
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="gdata.html"><font color="#ffffff">gdata</font></a>.gauth</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/usr/local/svn/gdata-python-client/src/gdata/gauth.py">/usr/local/svn/gdata-python-client/src/gdata/gauth.py</a></font></td></tr></table>
<p><tt>Provides auth related token classes and functions for Google Data APIs.<br>
<br>
Token classes represent a user's authorization of this app to access their<br>
data. Usually these are not created directly but by a GDClient <a href="__builtin__.html#object">object</a>.<br>
<br>
<a href="#ClientLoginToken">ClientLoginToken</a><br>
<a href="#AuthSubToken">AuthSubToken</a><br>
<a href="#SecureAuthSubToken">SecureAuthSubToken</a><br>
<a href="#OAuthHmacToken">OAuthHmacToken</a><br>
<a href="#OAuthRsaToken">OAuthRsaToken</a><br>
<a href="#TwoLeggedOAuthHmacToken">TwoLeggedOAuthHmacToken</a><br>
<a href="#TwoLeggedOAuthRsaToken">TwoLeggedOAuthRsaToken</a><br>
<br>
Functions which are often used in application code (as opposed to just within<br>
the gdata-python-client library) are the following:<br>
<br>
generate_auth_sub_url<br>
authorize_request_token<br>
<br>
The following are helper functions which are used to save and load auth token<br>
objects in the App Engine datastore. These should only be used if you are using<br>
this library within App Engine:<br>
<br>
ae_load<br>
ae_save</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
<tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="atom.html">atom</a><br>
</td><td width="25%" valign=top><a href="random.html">random</a><br>
</td><td width="25%" valign=top><a href="time.html">time</a><br>
</td><td width="25%" valign=top><a href="urllib.html">urllib</a><br>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
<tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="gdata.gauth.html#AuthSubToken">AuthSubToken</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="gdata.gauth.html#SecureAuthSubToken">SecureAuthSubToken</a>
</font></dt></dl>
</dd>
<dt><font face="helvetica, arial"><a href="gdata.gauth.html#ClientLoginToken">ClientLoginToken</a>
</font></dt><dt><font face="helvetica, arial"><a href="gdata.gauth.html#OAuthHmacToken">OAuthHmacToken</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="gdata.gauth.html#OAuthRsaToken">OAuthRsaToken</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="gdata.gauth.html#TwoLeggedOAuthRsaToken">TwoLeggedOAuthRsaToken</a>
</font></dt></dl>
</dd>
<dt><font face="helvetica, arial"><a href="gdata.gauth.html#TwoLeggedOAuthHmacToken">TwoLeggedOAuthHmacToken</a>
</font></dt></dl>
</dd>
</dl>
</dd>
<dt><font face="helvetica, arial"><a href="exceptions.html#Exception">exceptions.Exception</a>(<a href="exceptions.html#BaseException">exceptions.BaseException</a>)
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="gdata.gauth.html#Error">Error</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="gdata.gauth.html#UnsupportedTokenType">UnsupportedTokenType</a>
</font></dt></dl>
</dd>
</dl>
</dd>
</dl>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="AuthSubToken">class <strong>AuthSubToken</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
<tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="AuthSubToken-ModifyRequest"><strong>ModifyRequest</strong></a> = <a href="#AuthSubToken-modify_request">modify_request</a>(self, http_request)</dt></dl>
<dl><dt><a name="AuthSubToken-__init__"><strong>__init__</strong></a>(self, token_string, scopes<font color="#909090">=None</font>)</dt></dl>
<dl><dt><a name="AuthSubToken-modify_request"><strong>modify_request</strong></a>(self, http_request)</dt><dd><tt>Sets Authorization header, allows app to act on the user's behalf.</tt></dd></dl>
<hr>
Static methods defined here:<br>
<dl><dt><a name="AuthSubToken-FromUrl"><strong>FromUrl</strong></a> = from_url(str_or_uri)</dt><dd><tt>Creates a new <a href="#AuthSubToken">AuthSubToken</a> using information in the URL.<br>
<br>
Uses auth_sub_string_from_url.<br>
<br>
Args:<br>
str_or_uri: The current page's URL (as a str or atom.http_core.Uri)<br>
which should contain a token query parameter since the<br>
Google auth server redirected the user's browser to this<br>
URL.</tt></dd></dl>
<dl><dt><a name="AuthSubToken-from_url"><strong>from_url</strong></a>(str_or_uri)</dt><dd><tt>Creates a new <a href="#AuthSubToken">AuthSubToken</a> using information in the URL.<br>
<br>
Uses auth_sub_string_from_url.<br>
<br>
Args:<br>
str_or_uri: The current page's URL (as a str or atom.http_core.Uri)<br>
which should contain a token query parameter since the<br>
Google auth server redirected the user's browser to this<br>
URL.</tt></dd></dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="ClientLoginToken">class <strong>ClientLoginToken</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
<tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="ClientLoginToken-ModifyRequest"><strong>ModifyRequest</strong></a> = <a href="#ClientLoginToken-modify_request">modify_request</a>(self, http_request)</dt></dl>
<dl><dt><a name="ClientLoginToken-__init__"><strong>__init__</strong></a>(self, token_string)</dt></dl>
<dl><dt><a name="ClientLoginToken-modify_request"><strong>modify_request</strong></a>(self, http_request)</dt></dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="Error">class <strong>Error</strong></a>(<a href="exceptions.html#Exception">exceptions.Exception</a>)</font></td></tr>
<tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd><a href="gdata.gauth.html#Error">Error</a></dd>
<dd><a href="exceptions.html#Exception">exceptions.Exception</a></dd>
<dd><a href="exceptions.html#BaseException">exceptions.BaseException</a></dd>
<dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
</dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
<hr>
Methods inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br>
<dl><dt><a name="Error-__init__"><strong>__init__</strong></a>(...)</dt><dd><tt>x.<a href="#Error-__init__">__init__</a>(...) initializes x; see x.__class__.__doc__ for signature</tt></dd></dl>
<hr>
Data and other attributes inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br>
<dl><dt><strong>__new__</strong> = <built-in method __new__ of type object at 0x74d100><dd><tt>T.<a href="#Error-__new__">__new__</a>(S, ...) -> a new <a href="__builtin__.html#object">object</a> with type S, a subtype of T</tt></dl>
<hr>
Methods inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br>
<dl><dt><a name="Error-__delattr__"><strong>__delattr__</strong></a>(...)</dt><dd><tt>x.<a href="#Error-__delattr__">__delattr__</a>('name') <==> del x.name</tt></dd></dl>
<dl><dt><a name="Error-__getattribute__"><strong>__getattribute__</strong></a>(...)</dt><dd><tt>x.<a href="#Error-__getattribute__">__getattribute__</a>('name') <==> x.name</tt></dd></dl>
<dl><dt><a name="Error-__getitem__"><strong>__getitem__</strong></a>(...)</dt><dd><tt>x.<a href="#Error-__getitem__">__getitem__</a>(y) <==> x[y]</tt></dd></dl>
<dl><dt><a name="Error-__getslice__"><strong>__getslice__</strong></a>(...)</dt><dd><tt>x.<a href="#Error-__getslice__">__getslice__</a>(i, j) <==> x[i:j]<br>
<br>
Use of negative indices is not supported.</tt></dd></dl>
<dl><dt><a name="Error-__reduce__"><strong>__reduce__</strong></a>(...)</dt></dl>
<dl><dt><a name="Error-__repr__"><strong>__repr__</strong></a>(...)</dt><dd><tt>x.<a href="#Error-__repr__">__repr__</a>() <==> repr(x)</tt></dd></dl>
<dl><dt><a name="Error-__setattr__"><strong>__setattr__</strong></a>(...)</dt><dd><tt>x.<a href="#Error-__setattr__">__setattr__</a>('name', value) <==> x.name = value</tt></dd></dl>
<dl><dt><a name="Error-__setstate__"><strong>__setstate__</strong></a>(...)</dt></dl>
<dl><dt><a name="Error-__str__"><strong>__str__</strong></a>(...)</dt><dd><tt>x.<a href="#Error-__str__">__str__</a>() <==> str(x)</tt></dd></dl>
<dl><dt><a name="Error-__unicode__"><strong>__unicode__</strong></a>(...)</dt></dl>
<hr>
Data descriptors inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br>
<dl><dt><strong>__dict__</strong></dt>
</dl>
<dl><dt><strong>args</strong></dt>
</dl>
<dl><dt><strong>message</strong></dt>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="OAuthHmacToken">class <strong>OAuthHmacToken</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
<tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="OAuthHmacToken-GenerateAuthorizationUrl"><strong>GenerateAuthorizationUrl</strong></a> = <a href="#OAuthHmacToken-generate_authorization_url">generate_authorization_url</a>(self, google_apps_domain<font color="#909090">='default'</font>, language<font color="#909090">=None</font>, btmpl<font color="#909090">=None</font>, auth_server<font color="#909090">='https://www.google.com/accounts/OAuthAuthorizeToken'</font>)</dt></dl>
<dl><dt><a name="OAuthHmacToken-ModifyRequest"><strong>ModifyRequest</strong></a> = <a href="#OAuthHmacToken-modify_request">modify_request</a>(self, http_request)</dt></dl>
<dl><dt><a name="OAuthHmacToken-__init__"><strong>__init__</strong></a>(self, consumer_key, consumer_secret, token, token_secret, auth_state, next<font color="#909090">=None</font>, verifier<font color="#909090">=None</font>)</dt></dl>
<dl><dt><a name="OAuthHmacToken-generate_authorization_url"><strong>generate_authorization_url</strong></a>(self, google_apps_domain<font color="#909090">='default'</font>, language<font color="#909090">=None</font>, btmpl<font color="#909090">=None</font>, auth_server<font color="#909090">='https://www.google.com/accounts/OAuthAuthorizeToken'</font>)</dt><dd><tt>Creates the URL at which the user can authorize this app to access.<br>
<br>
Args:<br>
google_apps_domain: str (optional) If the user should be signing in<br>
using an account under a known Google Apps domain, provide the<br>
domain name ('example.com') here. If not provided, 'default'<br>
will be used, and the user will be prompted to select an account<br>
if they are signed in with a Google Account and Google Apps<br>
accounts.<br>
language: str (optional) An ISO 639 country code identifying what<br>
language the approval page should be translated in (for example,<br>
'en' for English). The default is the user's selected language.<br>
btmpl: str (optional) Forces a mobile version of the approval page. The<br>
only accepted value is 'mobile'.<br>
auth_server: str (optional) The start of the token authorization web<br>
page. Defaults to<br>
'https://www.google.com/accounts/OAuthAuthorizeToken'</tt></dd></dl>
<dl><dt><a name="OAuthHmacToken-modify_request"><strong>modify_request</strong></a>(self, http_request)</dt><dd><tt>Sets the Authorization header in the HTTP request using the token.<br>
<br>
Calculates an HMAC signature using the information in the token to<br>
indicate that the request came from this application and that this<br>
application has permission to access a particular user's data.<br>
<br>
Returns:<br>
The same HTTP request <a href="__builtin__.html#object">object</a> which was passed in.</tt></dd></dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
<hr>
Data and other attributes defined here:<br>
<dl><dt><strong>SIGNATURE_METHOD</strong> = 'HMAC-SHA1'</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="OAuthRsaToken">class <strong>OAuthRsaToken</strong></a>(<a href="gdata.gauth.html#OAuthHmacToken">OAuthHmacToken</a>)</font></td></tr>
<tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd><a href="gdata.gauth.html#OAuthRsaToken">OAuthRsaToken</a></dd>
<dd><a href="gdata.gauth.html#OAuthHmacToken">OAuthHmacToken</a></dd>
<dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
</dl>
<hr>
Methods defined here:<br>
<dl><dt><a name="OAuthRsaToken-ModifyRequest"><strong>ModifyRequest</strong></a> = <a href="#OAuthRsaToken-modify_request">modify_request</a>(self, http_request)</dt></dl>
<dl><dt><a name="OAuthRsaToken-__init__"><strong>__init__</strong></a>(self, consumer_key, rsa_private_key, token, token_secret, auth_state, next<font color="#909090">=None</font>, verifier<font color="#909090">=None</font>)</dt></dl>
<dl><dt><a name="OAuthRsaToken-modify_request"><strong>modify_request</strong></a>(self, http_request)</dt><dd><tt>Sets the Authorization header in the HTTP request using the token.<br>
<br>
Calculates an RSA signature using the information in the token to<br>
indicate that the request came from this application and that this<br>
application has permission to access a particular user's data.<br>
<br>
Returns:<br>
The same HTTP request <a href="__builtin__.html#object">object</a> which was passed in.</tt></dd></dl>
<hr>
Data and other attributes defined here:<br>
<dl><dt><strong>SIGNATURE_METHOD</strong> = 'RSA-SHA1'</dl>
<hr>
Methods inherited from <a href="gdata.gauth.html#OAuthHmacToken">OAuthHmacToken</a>:<br>
<dl><dt><a name="OAuthRsaToken-GenerateAuthorizationUrl"><strong>GenerateAuthorizationUrl</strong></a> = generate_authorization_url(self, google_apps_domain<font color="#909090">='default'</font>, language<font color="#909090">=None</font>, btmpl<font color="#909090">=None</font>, auth_server<font color="#909090">='https://www.google.com/accounts/OAuthAuthorizeToken'</font>)</dt><dd><tt>Creates the URL at which the user can authorize this app to access.<br>
<br>
Args:<br>
google_apps_domain: str (optional) If the user should be signing in<br>
using an account under a known Google Apps domain, provide the<br>
domain name ('example.com') here. If not provided, 'default'<br>
will be used, and the user will be prompted to select an account<br>
if they are signed in with a Google Account and Google Apps<br>
accounts.<br>
language: str (optional) An ISO 639 country code identifying what<br>
language the approval page should be translated in (for example,<br>
'en' for English). The default is the user's selected language.<br>
btmpl: str (optional) Forces a mobile version of the approval page. The<br>
only accepted value is 'mobile'.<br>
auth_server: str (optional) The start of the token authorization web<br>
page. Defaults to<br>
'https://www.google.com/accounts/OAuthAuthorizeToken'</tt></dd></dl>
<dl><dt><a name="OAuthRsaToken-generate_authorization_url"><strong>generate_authorization_url</strong></a>(self, google_apps_domain<font color="#909090">='default'</font>, language<font color="#909090">=None</font>, btmpl<font color="#909090">=None</font>, auth_server<font color="#909090">='https://www.google.com/accounts/OAuthAuthorizeToken'</font>)</dt><dd><tt>Creates the URL at which the user can authorize this app to access.<br>
<br>
Args:<br>
google_apps_domain: str (optional) If the user should be signing in<br>
using an account under a known Google Apps domain, provide the<br>
domain name ('example.com') here. If not provided, 'default'<br>
will be used, and the user will be prompted to select an account<br>
if they are signed in with a Google Account and Google Apps<br>
accounts.<br>
language: str (optional) An ISO 639 country code identifying what<br>
language the approval page should be translated in (for example,<br>
'en' for English). The default is the user's selected language.<br>
btmpl: str (optional) Forces a mobile version of the approval page. The<br>
only accepted value is 'mobile'.<br>
auth_server: str (optional) The start of the token authorization web<br>
page. Defaults to<br>
'https://www.google.com/accounts/OAuthAuthorizeToken'</tt></dd></dl>
<hr>
Data descriptors inherited from <a href="gdata.gauth.html#OAuthHmacToken">OAuthHmacToken</a>:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="SecureAuthSubToken">class <strong>SecureAuthSubToken</strong></a>(<a href="gdata.gauth.html#AuthSubToken">AuthSubToken</a>)</font></td></tr>
<tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd><a href="gdata.gauth.html#SecureAuthSubToken">SecureAuthSubToken</a></dd>
<dd><a href="gdata.gauth.html#AuthSubToken">AuthSubToken</a></dd>
<dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
</dl>
<hr>
Methods defined here:<br>
<dl><dt><a name="SecureAuthSubToken-ModifyRequest"><strong>ModifyRequest</strong></a> = <a href="#SecureAuthSubToken-modify_request">modify_request</a>(self, http_request)</dt></dl>
<dl><dt><a name="SecureAuthSubToken-__init__"><strong>__init__</strong></a>(self, token_string, rsa_private_key, scopes<font color="#909090">=None</font>)</dt></dl>
<dl><dt><a name="SecureAuthSubToken-modify_request"><strong>modify_request</strong></a>(self, http_request)</dt><dd><tt>Sets the Authorization header and includes a digital signature.<br>
<br>
Calculates a digital signature using the private RSA key, a timestamp<br>
(uses now at the time this method is called) and a random nonce.<br>
<br>
Args:<br>
http_request: The atom.http_core.HttpRequest which contains all of the<br>
information needed to send a request to the remote server. The<br>
URL and the method of the request must be already set and cannot be<br>
changed after this token signs the request, or the signature will<br>
not be valid.</tt></dd></dl>
<hr>
Static methods defined here:<br>
<dl><dt><a name="SecureAuthSubToken-FromUrl"><strong>FromUrl</strong></a> = from_url(str_or_uri, rsa_private_key)</dt><dd><tt>Creates a new <a href="#SecureAuthSubToken">SecureAuthSubToken</a> using information in the URL.<br>
<br>
Uses auth_sub_string_from_url.<br>
<br>
Args:<br>
str_or_uri: The current page's URL (as a str or atom.http_core.Uri)<br>
which should contain a token query parameter since the Google auth<br>
server redirected the user's browser to this URL.<br>
rsa_private_key: str the private RSA key cert used to sign all requests<br>
made with this token.</tt></dd></dl>
<dl><dt><a name="SecureAuthSubToken-from_url"><strong>from_url</strong></a>(str_or_uri, rsa_private_key)</dt><dd><tt>Creates a new <a href="#SecureAuthSubToken">SecureAuthSubToken</a> using information in the URL.<br>
<br>
Uses auth_sub_string_from_url.<br>
<br>
Args:<br>
str_or_uri: The current page's URL (as a str or atom.http_core.Uri)<br>
which should contain a token query parameter since the Google auth<br>
server redirected the user's browser to this URL.<br>
rsa_private_key: str the private RSA key cert used to sign all requests<br>
made with this token.</tt></dd></dl>
<hr>
Data descriptors inherited from <a href="gdata.gauth.html#AuthSubToken">AuthSubToken</a>:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="TwoLeggedOAuthHmacToken">class <strong>TwoLeggedOAuthHmacToken</strong></a>(<a href="gdata.gauth.html#OAuthHmacToken">OAuthHmacToken</a>)</font></td></tr>
<tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd><a href="gdata.gauth.html#TwoLeggedOAuthHmacToken">TwoLeggedOAuthHmacToken</a></dd>
<dd><a href="gdata.gauth.html#OAuthHmacToken">OAuthHmacToken</a></dd>
<dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
</dl>
<hr>
Methods defined here:<br>
<dl><dt><a name="TwoLeggedOAuthHmacToken-ModifyRequest"><strong>ModifyRequest</strong></a> = <a href="#TwoLeggedOAuthHmacToken-modify_request">modify_request</a>(self, http_request)</dt></dl>
<dl><dt><a name="TwoLeggedOAuthHmacToken-__init__"><strong>__init__</strong></a>(self, consumer_key, consumer_secret, requestor_id)</dt></dl>
<dl><dt><a name="TwoLeggedOAuthHmacToken-modify_request"><strong>modify_request</strong></a>(self, http_request)</dt><dd><tt>Sets the Authorization header in the HTTP request using the token.<br>
<br>
Calculates an HMAC signature using the information in the token to<br>
indicate that the request came from this application and that this<br>
application has permission to access a particular user's data using 2LO.<br>
<br>
Returns:<br>
The same HTTP request <a href="__builtin__.html#object">object</a> which was passed in.</tt></dd></dl>
<hr>
Methods inherited from <a href="gdata.gauth.html#OAuthHmacToken">OAuthHmacToken</a>:<br>
<dl><dt><a name="TwoLeggedOAuthHmacToken-GenerateAuthorizationUrl"><strong>GenerateAuthorizationUrl</strong></a> = generate_authorization_url(self, google_apps_domain<font color="#909090">='default'</font>, language<font color="#909090">=None</font>, btmpl<font color="#909090">=None</font>, auth_server<font color="#909090">='https://www.google.com/accounts/OAuthAuthorizeToken'</font>)</dt><dd><tt>Creates the URL at which the user can authorize this app to access.<br>
<br>
Args:<br>
google_apps_domain: str (optional) If the user should be signing in<br>
using an account under a known Google Apps domain, provide the<br>
domain name ('example.com') here. If not provided, 'default'<br>
will be used, and the user will be prompted to select an account<br>
if they are signed in with a Google Account and Google Apps<br>
accounts.<br>
language: str (optional) An ISO 639 country code identifying what<br>
language the approval page should be translated in (for example,<br>
'en' for English). The default is the user's selected language.<br>
btmpl: str (optional) Forces a mobile version of the approval page. The<br>
only accepted value is 'mobile'.<br>
auth_server: str (optional) The start of the token authorization web<br>
page. Defaults to<br>
'https://www.google.com/accounts/OAuthAuthorizeToken'</tt></dd></dl>
<dl><dt><a name="TwoLeggedOAuthHmacToken-generate_authorization_url"><strong>generate_authorization_url</strong></a>(self, google_apps_domain<font color="#909090">='default'</font>, language<font color="#909090">=None</font>, btmpl<font color="#909090">=None</font>, auth_server<font color="#909090">='https://www.google.com/accounts/OAuthAuthorizeToken'</font>)</dt><dd><tt>Creates the URL at which the user can authorize this app to access.<br>
<br>
Args:<br>
google_apps_domain: str (optional) If the user should be signing in<br>
using an account under a known Google Apps domain, provide the<br>
domain name ('example.com') here. If not provided, 'default'<br>
will be used, and the user will be prompted to select an account<br>
if they are signed in with a Google Account and Google Apps<br>
accounts.<br>
language: str (optional) An ISO 639 country code identifying what<br>
language the approval page should be translated in (for example,<br>
'en' for English). The default is the user's selected language.<br>
btmpl: str (optional) Forces a mobile version of the approval page. The<br>
only accepted value is 'mobile'.<br>
auth_server: str (optional) The start of the token authorization web<br>
page. Defaults to<br>
'https://www.google.com/accounts/OAuthAuthorizeToken'</tt></dd></dl>
<hr>
Data descriptors inherited from <a href="gdata.gauth.html#OAuthHmacToken">OAuthHmacToken</a>:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
<hr>
Data and other attributes inherited from <a href="gdata.gauth.html#OAuthHmacToken">OAuthHmacToken</a>:<br>
<dl><dt><strong>SIGNATURE_METHOD</strong> = 'HMAC-SHA1'</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="TwoLeggedOAuthRsaToken">class <strong>TwoLeggedOAuthRsaToken</strong></a>(<a href="gdata.gauth.html#OAuthRsaToken">OAuthRsaToken</a>)</font></td></tr>
<tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd><a href="gdata.gauth.html#TwoLeggedOAuthRsaToken">TwoLeggedOAuthRsaToken</a></dd>
<dd><a href="gdata.gauth.html#OAuthRsaToken">OAuthRsaToken</a></dd>
<dd><a href="gdata.gauth.html#OAuthHmacToken">OAuthHmacToken</a></dd>
<dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
</dl>
<hr>
Methods defined here:<br>
<dl><dt><a name="TwoLeggedOAuthRsaToken-ModifyRequest"><strong>ModifyRequest</strong></a> = <a href="#TwoLeggedOAuthRsaToken-modify_request">modify_request</a>(self, http_request)</dt></dl>
<dl><dt><a name="TwoLeggedOAuthRsaToken-__init__"><strong>__init__</strong></a>(self, consumer_key, rsa_private_key, requestor_id)</dt></dl>
<dl><dt><a name="TwoLeggedOAuthRsaToken-modify_request"><strong>modify_request</strong></a>(self, http_request)</dt><dd><tt>Sets the Authorization header in the HTTP request using the token.<br>
<br>
Calculates an RSA signature using the information in the token to<br>
indicate that the request came from this application and that this<br>
application has permission to access a particular user's data using 2LO.<br>
<br>
Returns:<br>
The same HTTP request <a href="__builtin__.html#object">object</a> which was passed in.</tt></dd></dl>
<hr>
Data and other attributes inherited from <a href="gdata.gauth.html#OAuthRsaToken">OAuthRsaToken</a>:<br>
<dl><dt><strong>SIGNATURE_METHOD</strong> = 'RSA-SHA1'</dl>
<hr>
Methods inherited from <a href="gdata.gauth.html#OAuthHmacToken">OAuthHmacToken</a>:<br>
<dl><dt><a name="TwoLeggedOAuthRsaToken-GenerateAuthorizationUrl"><strong>GenerateAuthorizationUrl</strong></a> = generate_authorization_url(self, google_apps_domain<font color="#909090">='default'</font>, language<font color="#909090">=None</font>, btmpl<font color="#909090">=None</font>, auth_server<font color="#909090">='https://www.google.com/accounts/OAuthAuthorizeToken'</font>)</dt><dd><tt>Creates the URL at which the user can authorize this app to access.<br>
<br>
Args:<br>
google_apps_domain: str (optional) If the user should be signing in<br>
using an account under a known Google Apps domain, provide the<br>
domain name ('example.com') here. If not provided, 'default'<br>
will be used, and the user will be prompted to select an account<br>
if they are signed in with a Google Account and Google Apps<br>
accounts.<br>
language: str (optional) An ISO 639 country code identifying what<br>
language the approval page should be translated in (for example,<br>
'en' for English). The default is the user's selected language.<br>
btmpl: str (optional) Forces a mobile version of the approval page. The<br>
only accepted value is 'mobile'.<br>
auth_server: str (optional) The start of the token authorization web<br>
page. Defaults to<br>
'https://www.google.com/accounts/OAuthAuthorizeToken'</tt></dd></dl>
<dl><dt><a name="TwoLeggedOAuthRsaToken-generate_authorization_url"><strong>generate_authorization_url</strong></a>(self, google_apps_domain<font color="#909090">='default'</font>, language<font color="#909090">=None</font>, btmpl<font color="#909090">=None</font>, auth_server<font color="#909090">='https://www.google.com/accounts/OAuthAuthorizeToken'</font>)</dt><dd><tt>Creates the URL at which the user can authorize this app to access.<br>
<br>
Args:<br>
google_apps_domain: str (optional) If the user should be signing in<br>
using an account under a known Google Apps domain, provide the<br>
domain name ('example.com') here. If not provided, 'default'<br>
will be used, and the user will be prompted to select an account<br>
if they are signed in with a Google Account and Google Apps<br>
accounts.<br>
language: str (optional) An ISO 639 country code identifying what<br>
language the approval page should be translated in (for example,<br>
'en' for English). The default is the user's selected language.<br>
btmpl: str (optional) Forces a mobile version of the approval page. The<br>
only accepted value is 'mobile'.<br>
auth_server: str (optional) The start of the token authorization web<br>
page. Defaults to<br>
'https://www.google.com/accounts/OAuthAuthorizeToken'</tt></dd></dl>
<hr>
Data descriptors inherited from <a href="gdata.gauth.html#OAuthHmacToken">OAuthHmacToken</a>:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="UnsupportedTokenType">class <strong>UnsupportedTokenType</strong></a>(<a href="gdata.gauth.html#Error">Error</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt>Raised when token to or from blob is unable to convert the token.<br> </tt></td></tr>
<tr><td> </td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd><a href="gdata.gauth.html#UnsupportedTokenType">UnsupportedTokenType</a></dd>
<dd><a href="gdata.gauth.html#Error">Error</a></dd>
<dd><a href="exceptions.html#Exception">exceptions.Exception</a></dd>
<dd><a href="exceptions.html#BaseException">exceptions.BaseException</a></dd>
<dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
</dl>
<hr>
Data descriptors inherited from <a href="gdata.gauth.html#Error">Error</a>:<br>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
<hr>
Methods inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br>
<dl><dt><a name="UnsupportedTokenType-__init__"><strong>__init__</strong></a>(...)</dt><dd><tt>x.<a href="#UnsupportedTokenType-__init__">__init__</a>(...) initializes x; see x.__class__.__doc__ for signature</tt></dd></dl>
<hr>
Data and other attributes inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br>
<dl><dt><strong>__new__</strong> = <built-in method __new__ of type object at 0x74d100><dd><tt>T.<a href="#UnsupportedTokenType-__new__">__new__</a>(S, ...) -> a new <a href="__builtin__.html#object">object</a> with type S, a subtype of T</tt></dl>
<hr>
Methods inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br>
<dl><dt><a name="UnsupportedTokenType-__delattr__"><strong>__delattr__</strong></a>(...)</dt><dd><tt>x.<a href="#UnsupportedTokenType-__delattr__">__delattr__</a>('name') <==> del x.name</tt></dd></dl>
<dl><dt><a name="UnsupportedTokenType-__getattribute__"><strong>__getattribute__</strong></a>(...)</dt><dd><tt>x.<a href="#UnsupportedTokenType-__getattribute__">__getattribute__</a>('name') <==> x.name</tt></dd></dl>
<dl><dt><a name="UnsupportedTokenType-__getitem__"><strong>__getitem__</strong></a>(...)</dt><dd><tt>x.<a href="#UnsupportedTokenType-__getitem__">__getitem__</a>(y) <==> x[y]</tt></dd></dl>
<dl><dt><a name="UnsupportedTokenType-__getslice__"><strong>__getslice__</strong></a>(...)</dt><dd><tt>x.<a href="#UnsupportedTokenType-__getslice__">__getslice__</a>(i, j) <==> x[i:j]<br>
<br>
Use of negative indices is not supported.</tt></dd></dl>
<dl><dt><a name="UnsupportedTokenType-__reduce__"><strong>__reduce__</strong></a>(...)</dt></dl>
<dl><dt><a name="UnsupportedTokenType-__repr__"><strong>__repr__</strong></a>(...)</dt><dd><tt>x.<a href="#UnsupportedTokenType-__repr__">__repr__</a>() <==> repr(x)</tt></dd></dl>
<dl><dt><a name="UnsupportedTokenType-__setattr__"><strong>__setattr__</strong></a>(...)</dt><dd><tt>x.<a href="#UnsupportedTokenType-__setattr__">__setattr__</a>('name', value) <==> x.name = value</tt></dd></dl>
<dl><dt><a name="UnsupportedTokenType-__setstate__"><strong>__setstate__</strong></a>(...)</dt></dl>
<dl><dt><a name="UnsupportedTokenType-__str__"><strong>__str__</strong></a>(...)</dt><dd><tt>x.<a href="#UnsupportedTokenType-__str__">__str__</a>() <==> str(x)</tt></dd></dl>
<dl><dt><a name="UnsupportedTokenType-__unicode__"><strong>__unicode__</strong></a>(...)</dt></dl>
<hr>
Data descriptors inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br>
<dl><dt><strong>__dict__</strong></dt>
</dl>
<dl><dt><strong>args</strong></dt>
</dl>
<dl><dt><strong>message</strong></dt>
</dl>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
<tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td>
<td width="100%"><dl><dt><a name="-AeDelete"><strong>AeDelete</strong></a> = ae_delete(token_key)</dt><dd><tt>Removes the token <a href="__builtin__.html#object">object</a> from the App Engine datastore.</tt></dd></dl>
<dl><dt><a name="-AeLoad"><strong>AeLoad</strong></a> = ae_load(token_key)</dt><dd><tt>Retrieves a token <a href="__builtin__.html#object">object</a> from the App Engine datastore.<br>
<br>
This is a convenience method for using the library with App Engine.<br>
See also ae_save.<br>
<br>
Args:<br>
token_key: str The unique key associated with the desired token when it<br>
was saved using ae_save.<br>
<br>
Returns:<br>
A token <a href="__builtin__.html#object">object</a> if there was a token associated with the token_key or None<br>
if the key could not be found.</tt></dd></dl>
<dl><dt><a name="-AeSave"><strong>AeSave</strong></a> = ae_save(token, token_key)</dt><dd><tt>Stores an auth token in the App Engine datastore.<br>
<br>
This is a convenience method for using the library with App Engine.<br>
Recommended usage is to associate the auth token with the current_user.<br>
If a user is signed in to the app using the App Engine users API, you<br>
can use<br>
gdata.gauth.<a href="#-ae_save">ae_save</a>(some_token, users.get_current_user().user_id())<br>
If you are not using the Users API you are free to choose whatever<br>
string you would like for a token_string.<br>
<br>
Args:<br>
token: an auth token <a href="__builtin__.html#object">object</a>. Must be one of <a href="#ClientLoginToken">ClientLoginToken</a>,<br>
<a href="#AuthSubToken">AuthSubToken</a>, <a href="#SecureAuthSubToken">SecureAuthSubToken</a>, <a href="#OAuthRsaToken">OAuthRsaToken</a>, or <a href="#OAuthHmacToken">OAuthHmacToken</a><br>
(see token_to_blob).<br>
token_key: str A unique identified to be used when you want to retrieve<br>
the token. If the user is signed in to App Engine using the<br>
users API, I recommend using the user ID for the token_key:<br>
users.get_current_user().user_id()</tt></dd></dl>
<dl><dt><a name="-AuthSubStringFromUrl"><strong>AuthSubStringFromUrl</strong></a> = auth_sub_string_from_url(url, scopes_param_prefix<font color="#909090">='auth_sub_scopes'</font>)</dt><dd><tt>Finds the token string (and scopes) after the browser is redirected.<br>
<br>
After the Google Accounts AuthSub pages redirect the user's broswer back to<br>
the web application (using the 'next' URL from the request) the web app must<br>
extract the token from the current page's URL. The token is provided as a<br>
URL parameter named 'token' and if generate_auth_sub_url was used to create<br>
the request, the token's valid scopes are included in a URL parameter whose<br>
name is specified in scopes_param_prefix.<br>
<br>
Args:<br>
url: atom.url.Url or str representing the current URL. The token value<br>
and valid scopes should be included as URL parameters.<br>
scopes_param_prefix: str (optional) The URL parameter key which maps to<br>
the list of valid scopes for the token.<br>
<br>
Returns:<br>
A tuple containing the token value as a string, and a tuple of scopes<br>
(as atom.http_core.Uri objects) which are URL prefixes under which this<br>
token grants permission to read and write user data.<br>
(token_string, (scope_uri, scope_uri, scope_uri, ...))<br>
If no scopes were included in the URL, the second value in the tuple is<br>
None. If there was no token param in the url, the tuple returned is<br>
(None, None)</tt></dd></dl>
<dl><dt><a name="-AuthorizeRequestToken"><strong>AuthorizeRequestToken</strong></a> = authorize_request_token(request_token, url)</dt><dd><tt>Adds information to request token to allow it to become an access token.<br>
<br>
Modifies the request_token <a href="__builtin__.html#object">object</a> passed in by setting and unsetting the<br>
necessary fields to allow this token to form a valid upgrade request.<br>
<br>
Args:<br>
request_token: The OAuth request token which has been authorized by the<br>
user. In order for this token to be upgraded to an access token,<br>
certain fields must be extracted from the URL and added to the token<br>
so that they can be passed in an upgrade-token request.<br>
url: The URL of the current page which the user's browser was redirected<br>
to after they authorized access for the app. This function extracts<br>
information from the URL which is needed to upgraded the token from<br>
a request token to an access token.<br>
<br>
Returns:<br>
The same token <a href="__builtin__.html#object">object</a> which was passed in.</tt></dd></dl>
<dl><dt><a name="-FindScopesForServices"><strong>FindScopesForServices</strong></a> = find_scopes_for_services(service_names<font color="#909090">=None</font>)</dt><dd><tt>Creates a combined list of scope URLs for the desired services.<br>
<br>
This method searches the AUTH_SCOPES dictionary.<br>
<br>
Args:<br>
service_names: list of strings (optional) Each name must be a key in the<br>
AUTH_SCOPES dictionary. If no list is provided (None) then<br>
the resulting list will contain all scope URLs in the<br>
AUTH_SCOPES dict.<br>
<br>
Returns:<br>
A list of URL strings which are the scopes needed to access these services<br>
when requesting a token using AuthSub or OAuth.</tt></dd></dl>
<dl><dt><a name="-GenerateClientLoginRequestBody"><strong>GenerateClientLoginRequestBody</strong></a> = generate_client_login_request_body(email, password, service, source, account_type<font color="#909090">='HOSTED_OR_GOOGLE'</font>, captcha_token<font color="#909090">=None</font>, captcha_response<font color="#909090">=None</font>)</dt><dd><tt>Creates the body of the autentication request<br>
<br>
See <a href="http://code.google.com/apis/accounts/AuthForInstalledApps.html#Request">http://code.google.com/apis/accounts/AuthForInstalledApps.html#Request</a><br>
for more details.<br>
<br>
Args:<br>
email: str<br>
password: str<br>
service: str<br>
source: str<br>
account_type: str (optional) Defaul is 'HOSTED_OR_GOOGLE', other valid<br>
values are 'GOOGLE' and 'HOSTED'<br>
captcha_token: str (optional)<br>
captcha_response: str (optional)<br>
<br>
Returns:<br>
The HTTP body to send in a request for a client login token.</tt></dd></dl>
<dl><dt><a name="-GetCaptchaChallenge"><strong>GetCaptchaChallenge</strong></a> = get_captcha_challenge(http_body, captcha_base_url<font color="#909090">='http://www.google.com/accounts/'</font>)</dt><dd><tt>Returns the URL and token for a CAPTCHA challenge issued by the server.<br>
<br>
Args:<br>
http_body: str The body of the HTTP response from the server which<br>
contains the CAPTCHA challenge.<br>
captcha_base_url: str This function returns a full URL for viewing the<br>
challenge image which is built from the server's response. This<br>
base_url is used as the beginning of the URL because the server<br>
only provides the end of the URL. For example the server provides<br>
'Captcha?ctoken=Hi...N' and the URL for the image is<br>
'<a href="http://www.google.com/accounts/Captcha?ctoken=Hi...N">http://www.google.com/accounts/Captcha?ctoken=Hi...N</a>'<br>
<br>
Returns:<br>
A dictionary containing the information needed to repond to the CAPTCHA<br>
challenge, the image URL and the ID token of the challenge. The<br>
dictionary is in the form:<br>
{'token': string identifying the CAPTCHA image,<br>
'url': string containing the URL of the image}<br>
Returns None if there was no CAPTCHA challenge in the response.</tt></dd></dl>
<dl><dt><a name="-GetClientLoginTokenString"><strong>GetClientLoginTokenString</strong></a> = get_client_login_token_string(http_body)</dt><dd><tt>Returns the token value for a <a href="#ClientLoginToken">ClientLoginToken</a>.<br>
<br>
Reads the token from the server's response to a Client Login request and<br>
creates the token value string to use in requests.<br>
<br>
Args:<br>
http_body: str The body of the server's HTTP response to a Client Login<br>
request<br>
<br>
Returns:<br>
The token value string for a <a href="#ClientLoginToken">ClientLoginToken</a>.</tt></dd></dl>
<dl><dt><a name="-TokenFromBlob"><strong>TokenFromBlob</strong></a> = token_from_blob(blob)</dt><dd><tt>Deserializes a token string from the datastore back into a token <a href="__builtin__.html#object">object</a>.<br>
<br>
Supported token classes: <a href="#ClientLoginToken">ClientLoginToken</a>, <a href="#AuthSubToken">AuthSubToken</a>, <a href="#SecureAuthSubToken">SecureAuthSubToken</a>,<br>
<a href="#OAuthRsaToken">OAuthRsaToken</a>, and <a href="#OAuthHmacToken">OAuthHmacToken</a>, <a href="#TwoLeggedOAuthRsaToken">TwoLeggedOAuthRsaToken</a>,<br>
<a href="#TwoLeggedOAuthHmacToken">TwoLeggedOAuthHmacToken</a>.<br>
<br>
Args:<br>
blob: string created by token_to_blob.<br>
<br>
Raises:<br>
<a href="#UnsupportedTokenType">UnsupportedTokenType</a> if the token is not one of the supported token<br>
classes listed above.<br>
<br>
Returns:<br>
A new token <a href="__builtin__.html#object">object</a> with members set to the values serialized in the<br>
blob string. Note that any members which were set to '' in the original<br>
token will now be None.</tt></dd></dl>
<dl><dt><a name="-TokenToBlob"><strong>TokenToBlob</strong></a> = token_to_blob(token)</dt><dd><tt>Serializes the token data as a string for storage in a datastore.<br>
<br>
Supported token classes: <a href="#ClientLoginToken">ClientLoginToken</a>, <a href="#AuthSubToken">AuthSubToken</a>, <a href="#SecureAuthSubToken">SecureAuthSubToken</a>,<br>
<a href="#OAuthRsaToken">OAuthRsaToken</a>, and <a href="#OAuthHmacToken">OAuthHmacToken</a>, <a href="#TwoLeggedOAuthRsaToken">TwoLeggedOAuthRsaToken</a>,<br>
<a href="#TwoLeggedOAuthHmacToken">TwoLeggedOAuthHmacToken</a>.<br>
<br>
Args:<br>
token: A token <a href="__builtin__.html#object">object</a> which must be of one of the supported token classes.<br>
<br>
Raises:<br>
<a href="#UnsupportedTokenType">UnsupportedTokenType</a> if the token is not one of the supported token<br>
classes listed above.<br>
<br>
Returns:<br>
A string represenging this token. The string can be converted back into<br>
an equivalent token <a href="__builtin__.html#object">object</a> using token_from_blob. Note that any members<br>
which are set to '' will be set to None when the token is deserialized<br>
by token_from_blob.</tt></dd></dl>
<dl><dt><a name="-UpgradeToAccessToken"><strong>UpgradeToAccessToken</strong></a> = upgrade_to_access_token(request_token, server_response_body)</dt><dd><tt>Extracts access token information from response to an upgrade request.<br>
<br>
Once the server has responded with the new token info for the OAuth<br>
access token, this method modifies the request_token to set and unset<br>
necessary fields to create valid OAuth authorization headers for requests.<br>
<br>
Args:<br>
request_token: An OAuth token which this function modifies to allow it<br>
to be used as an access token.<br>
server_response_body: str The server's response to an OAuthAuthorizeToken<br>
request. This should contain the new token and token_secret which<br>
are used to generate the signature and parameters of the Authorization<br>
header in subsequent requests to Google Data APIs.<br>
<br>
Returns:<br>
The same token <a href="__builtin__.html#object">object</a> which was passed in.</tt></dd></dl>
<dl><dt><a name="-ae_delete"><strong>ae_delete</strong></a>(token_key)</dt><dd><tt>Removes the token <a href="__builtin__.html#object">object</a> from the App Engine datastore.</tt></dd></dl>
<dl><dt><a name="-ae_load"><strong>ae_load</strong></a>(token_key)</dt><dd><tt>Retrieves a token <a href="__builtin__.html#object">object</a> from the App Engine datastore.<br>
<br>
This is a convenience method for using the library with App Engine.<br>
See also ae_save.<br>
<br>
Args:<br>
token_key: str The unique key associated with the desired token when it<br>
was saved using ae_save.<br>
<br>
Returns:<br>
A token <a href="__builtin__.html#object">object</a> if there was a token associated with the token_key or None<br>
if the key could not be found.</tt></dd></dl>
<dl><dt><a name="-ae_save"><strong>ae_save</strong></a>(token, token_key)</dt><dd><tt>Stores an auth token in the App Engine datastore.<br>
<br>
This is a convenience method for using the library with App Engine.<br>
Recommended usage is to associate the auth token with the current_user.<br>
If a user is signed in to the app using the App Engine users API, you<br>
can use<br>
gdata.gauth.<a href="#-ae_save">ae_save</a>(some_token, users.get_current_user().user_id())<br>
If you are not using the Users API you are free to choose whatever<br>
string you would like for a token_string.<br>
<br>
Args:<br>
token: an auth token <a href="__builtin__.html#object">object</a>. Must be one of <a href="#ClientLoginToken">ClientLoginToken</a>,<br>
<a href="#AuthSubToken">AuthSubToken</a>, <a href="#SecureAuthSubToken">SecureAuthSubToken</a>, <a href="#OAuthRsaToken">OAuthRsaToken</a>, or <a href="#OAuthHmacToken">OAuthHmacToken</a><br>
(see token_to_blob).<br>
token_key: str A unique identified to be used when you want to retrieve<br>
the token. If the user is signed in to App Engine using the<br>
users API, I recommend using the user ID for the token_key:<br>
users.get_current_user().user_id()</tt></dd></dl>
<dl><dt><a name="-auth_sub_string_from_body"><strong>auth_sub_string_from_body</strong></a>(http_body)</dt><dd><tt>Extracts the AuthSub token from an HTTP body string.<br>
<br>
Used to find the new session token after making a request to upgrade a<br>
single use AuthSub token.<br>
<br>
Args:<br>
http_body: str The repsonse from the server which contains the AuthSub<br>
key. For example, this function would find the new session token<br>
from the server's response to an upgrade token request.<br>
<br>
Returns:<br>
The raw token value string to use in an <a href="#AuthSubToken">AuthSubToken</a> <a href="__builtin__.html#object">object</a>.</tt></dd></dl>
<dl><dt><a name="-auth_sub_string_from_url"><strong>auth_sub_string_from_url</strong></a>(url, scopes_param_prefix<font color="#909090">='auth_sub_scopes'</font>)</dt><dd><tt>Finds the token string (and scopes) after the browser is redirected.<br>
<br>
After the Google Accounts AuthSub pages redirect the user's broswer back to<br>
the web application (using the 'next' URL from the request) the web app must<br>
extract the token from the current page's URL. The token is provided as a<br>
URL parameter named 'token' and if generate_auth_sub_url was used to create<br>
the request, the token's valid scopes are included in a URL parameter whose<br>
name is specified in scopes_param_prefix.<br>
<br>
Args:<br>
url: atom.url.Url or str representing the current URL. The token value<br>
and valid scopes should be included as URL parameters.<br>
scopes_param_prefix: str (optional) The URL parameter key which maps to<br>
the list of valid scopes for the token.<br>
<br>
Returns:<br>
A tuple containing the token value as a string, and a tuple of scopes<br>
(as atom.http_core.Uri objects) which are URL prefixes under which this<br>
token grants permission to read and write user data.<br>
(token_string, (scope_uri, scope_uri, scope_uri, ...))<br>
If no scopes were included in the URL, the second value in the tuple is<br>
None. If there was no token param in the url, the tuple returned is<br>
(None, None)</tt></dd></dl>
<dl><dt><a name="-authorize_request_token"><strong>authorize_request_token</strong></a>(request_token, url)</dt><dd><tt>Adds information to request token to allow it to become an access token.<br>
<br>
Modifies the request_token <a href="__builtin__.html#object">object</a> passed in by setting and unsetting the<br>
necessary fields to allow this token to form a valid upgrade request.<br>
<br>
Args:<br>
request_token: The OAuth request token which has been authorized by the<br>
user. In order for this token to be upgraded to an access token,<br>
certain fields must be extracted from the URL and added to the token<br>
so that they can be passed in an upgrade-token request.<br>
url: The URL of the current page which the user's browser was redirected<br>
to after they authorized access for the app. This function extracts<br>
information from the URL which is needed to upgraded the token from<br>
a request token to an access token.<br>
<br>
Returns:<br>
The same token <a href="__builtin__.html#object">object</a> which was passed in.</tt></dd></dl>
<dl><dt><a name="-build_auth_sub_data"><strong>build_auth_sub_data</strong></a>(http_request, timestamp, nonce)</dt><dd><tt>Creates the data string which must be RSA-signed in secure requests.<br>
<br>
For more details see the documenation on secure AuthSub requests:<br>
<a href="http://code.google.com/apis/accounts/docs/AuthSub.html#signingrequests">http://code.google.com/apis/accounts/docs/AuthSub.html#signingrequests</a><br>
<br>
Args:<br>
http_request: The request being made to the server. The Request's URL<br>
must be complete before this signature is calculated as any changes<br>
to the URL will invalidate the signature.<br>
nonce: str Random 64-bit, unsigned number encoded as an ASCII string in<br>
decimal format. The nonce/timestamp pair should always be unique to<br>
prevent replay attacks.<br>
timestamp: Integer representing the time the request is sent. The<br>
timestamp should be expressed in number of seconds after January 1,<br>
1970 00:00:00 GMT.</tt></dd></dl>
<dl><dt><a name="-build_oauth_base_string"><strong>build_oauth_base_string</strong></a>(http_request, consumer_key, nonce, signaure_type, timestamp, version, next<font color="#909090">='oob'</font>, token<font color="#909090">=None</font>, verifier<font color="#909090">=None</font>)</dt><dd><tt>Generates the base string to be signed in the OAuth request.<br>
<br>
Args:<br>
http_request: The request being made to the server. The Request's URL<br>
must be complete before this signature is calculated as any changes<br>
to the URL will invalidate the signature.<br>
consumer_key: Domain identifying the third-party web application. This is<br>
the domain used when registering the application with Google. It<br>
identifies who is making the request on behalf of the user.<br>
nonce: Random 64-bit, unsigned number encoded as an ASCII string in decimal<br>
format. The nonce/timestamp pair should always be unique to prevent<br>
replay attacks.<br>
signaure_type: either RSA_SHA1 or HMAC_SHA1<br>
timestamp: Integer representing the time the request is sent. The<br>
timestamp should be expressed in number of seconds after January 1,<br>
1970 00:00:00 GMT.<br>
version: The OAuth version used by the requesting web application. This<br>
value must be '1.0' or '1.0a'. If not provided, Google assumes version<br>
1.0 is in use.<br>
next: The URL the user should be redirected to after granting access<br>
to a Google service(s). It can include url-encoded query parameters.<br>
The default value is 'oob'. (This is the oauth_callback.)<br>
token: The string for the OAuth request token or OAuth access token.<br>
verifier: str Sent as the oauth_verifier and required when upgrading a<br>
request token to an access token.</tt></dd></dl>
<dl><dt><a name="-dump_tokens"><strong>dump_tokens</strong></a>(tokens)</dt></dl>
<dl><dt><a name="-find_scopes_for_services"><strong>find_scopes_for_services</strong></a>(service_names<font color="#909090">=None</font>)</dt><dd><tt>Creates a combined list of scope URLs for the desired services.<br>
<br>
This method searches the AUTH_SCOPES dictionary.<br>
<br>
Args:<br>
service_names: list of strings (optional) Each name must be a key in the<br>
AUTH_SCOPES dictionary. If no list is provided (None) then<br>
the resulting list will contain all scope URLs in the<br>
AUTH_SCOPES dict.<br>
<br>
Returns:<br>
A list of URL strings which are the scopes needed to access these services<br>
when requesting a token using AuthSub or OAuth.</tt></dd></dl>
<dl><dt><a name="-generate_auth_header"><strong>generate_auth_header</strong></a>(consumer_key, timestamp, nonce, signature_type, signature, version<font color="#909090">='1.0'</font>, next<font color="#909090">=None</font>, token<font color="#909090">=None</font>, verifier<font color="#909090">=None</font>)</dt><dd><tt>Builds the Authorization header to be sent in the request.<br>
<br>
Args:<br>
consumer_key: Identifies the application making the request (str).<br>
timestamp:<br>
nonce:<br>
signature_type: One of either HMAC_SHA1 or RSA_SHA1<br>
signature: The HMAC or RSA signature for the request as a base64<br>
encoded string.<br>
version: The version of the OAuth protocol that this request is using.<br>
Default is '1.0'<br>
next: The URL of the page that the user's browser should be sent to<br>
after they authorize the token. (Optional)<br>
token: str The OAuth token value to be used in the oauth_token parameter<br>
of the header.<br>
verifier: str The OAuth verifier which must be included when you are<br>
upgrading a request token to an access token.</tt></dd></dl>
<dl><dt><a name="-generate_auth_sub_url"><strong>generate_auth_sub_url</strong></a>(next, scopes, secure<font color="#909090">=False</font>, session<font color="#909090">=True</font>, request_url<font color="#909090">=<atom.http_core.Uri object at 0xb27510></font>, domain<font color="#909090">='default'</font>, scopes_param_prefix<font color="#909090">='auth_sub_scopes'</font>)</dt><dd><tt>Constructs a URI for requesting a multiscope AuthSub token.<br>
<br>
The generated token will contain a URL parameter to pass along the<br>
requested scopes to the next URL. When the Google Accounts page<br>
redirects the broswser to the 'next' URL, it appends the single use<br>
AuthSub token value to the URL as a URL parameter with the key 'token'.<br>
However, the information about which scopes were requested is not<br>
included by Google Accounts. This method adds the scopes to the next<br>
URL before making the request so that the redirect will be sent to<br>
a page, and both the token value and the list of scopes for which the token<br>
was requested.<br>
<br>
Args:<br>
next: atom.http_core.Uri or string The URL user will be sent to after<br>
authorizing this web application to access their data.<br>
scopes: list containint strings or atom.http_core.Uri objects. The URLs<br>
of the services to be accessed. Could also be a single string<br>
or single atom.http_core.Uri for requesting just one scope.<br>
secure: boolean (optional) Determines whether or not the issued token<br>
is a secure token.<br>
session: boolean (optional) Determines whether or not the issued token<br>
can be upgraded to a session token.<br>
request_url: atom.http_core.Uri or str The beginning of the request URL.<br>
This is normally<br>
'<a href="http://www.google.com/accounts/AuthSubRequest">http://www.google.com/accounts/AuthSubRequest</a>' or<br>
'/accounts/AuthSubRequest'<br>
domain: The domain which the account is part of. This is used for Google<br>
Apps accounts, the default value is 'default' which means that<br>
the requested account is a Google Account (@gmail.com for<br>
example)<br>
scopes_param_prefix: str (optional) The requested scopes are added as a<br>
URL parameter to the next URL so that the page at<br>
the 'next' URL can extract the token value and the<br>
valid scopes from the URL. The key for the URL<br>