Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 1 | |
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 3 | <html><head><title>Python: module oauth2client.appengine</title> |
| 4 | </head><body bgcolor="#f0f0f8"> |
| 5 | |
| 6 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading"> |
| 7 | <tr bgcolor="#7799ee"> |
| 8 | <td valign=bottom> <br> |
| 9 | <font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="oauth2client.html"><font color="#ffffff">oauth2client</font></a>.appengine</strong></big></big></font></td |
| 10 | ><td align=right valign=bottom |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 11 | ><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/usr/local/google/home/jcgregorio/projects/apiclient-release/oauth2client/appengine.py">/usr/local/google/home/jcgregorio/projects/apiclient-release/oauth2client/appengine.py</a></font></td></tr></table> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 12 | <p><tt>Utilities for Google App Engine<br> |
| 13 | <br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 14 | Utilities for making it easier to use OAuth 2.0 on Google App Engine.</tt></p> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 15 | <p> |
| 16 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 17 | <tr bgcolor="#aa55cc"> |
| 18 | <td colspan=3 valign=bottom> <br> |
| 19 | <font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr> |
| 20 | |
| 21 | <tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 22 | <td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="google.appengine.api.app_identity.app_identity.html">google.appengine.api.app_identity.app_identity</a><br> |
| 23 | <a href="base64.html">base64</a><br> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 24 | <a href="oauth2client.clientsecrets.html">oauth2client.clientsecrets</a><br> |
| 25 | </td><td width="25%" valign=top><a href="google.appengine.ext.db.html">google.appengine.ext.db</a><br> |
| 26 | <a href="httplib2.html">httplib2</a><br> |
| 27 | <a href="logging.html">logging</a><br> |
| 28 | </td><td width="25%" valign=top><a href="google.appengine.api.memcache.html">google.appengine.api.memcache</a><br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 29 | <a href="pickle.html">pickle</a><br> |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 30 | <a href="json.html">json</a><br> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 31 | </td><td width="25%" valign=top><a href="time.html">time</a><br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 32 | <a href="google.appengine.api.users.html">google.appengine.api.users</a><br> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 33 | <a href="google.appengine.ext.webapp.html">google.appengine.ext.webapp</a><br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 34 | </td></tr></table></td></tr></table><p> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 35 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 36 | <tr bgcolor="#ee77aa"> |
| 37 | <td colspan=3 valign=bottom> <br> |
| 38 | <font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr> |
| 39 | |
| 40 | <tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td> |
| 41 | <td width="100%"><dl> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 42 | <dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a> |
| 43 | </font></dt><dd> |
| 44 | <dl> |
| 45 | <dt><font face="helvetica, arial"><a href="oauth2client.appengine.html#OAuth2Decorator">OAuth2Decorator</a> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 46 | </font></dt><dd> |
| 47 | <dl> |
| 48 | <dt><font face="helvetica, arial"><a href="oauth2client.appengine.html#OAuth2DecoratorFromClientSecrets">OAuth2DecoratorFromClientSecrets</a> |
| 49 | </font></dt></dl> |
| 50 | </dd> |
| 51 | </dl> |
| 52 | </dd> |
| 53 | <dt><font face="helvetica, arial"><a href="exceptions.html#Exception">exceptions.Exception</a>(<a href="exceptions.html#BaseException">exceptions.BaseException</a>) |
| 54 | </font></dt><dd> |
| 55 | <dl> |
| 56 | <dt><font face="helvetica, arial"><a href="oauth2client.appengine.html#InvalidClientSecretsError">InvalidClientSecretsError</a> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 57 | </font></dt></dl> |
| 58 | </dd> |
| 59 | <dt><font face="helvetica, arial"><a href="google.appengine.ext.db.html#Model">google.appengine.ext.db.Model</a>(<a href="__builtin__.html#object">__builtin__.object</a>) |
| 60 | </font></dt><dd> |
| 61 | <dl> |
| 62 | <dt><font face="helvetica, arial"><a href="oauth2client.appengine.html#CredentialsModel">CredentialsModel</a> |
| 63 | </font></dt></dl> |
| 64 | </dd> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 65 | <dt><font face="helvetica, arial"><a href="google.appengine.ext.db.html#Property">google.appengine.ext.db.Property</a>(<a href="__builtin__.html#object">__builtin__.object</a>) |
| 66 | </font></dt><dd> |
| 67 | <dl> |
| 68 | <dt><font face="helvetica, arial"><a href="oauth2client.appengine.html#CredentialsProperty">CredentialsProperty</a> |
| 69 | </font></dt><dt><font face="helvetica, arial"><a href="oauth2client.appengine.html#FlowProperty">FlowProperty</a> |
| 70 | </font></dt></dl> |
| 71 | </dd> |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 72 | <dt><font face="helvetica, arial"><a href="google.appengine.ext.webapp.html#RequestHandler">google.appengine.ext.webapp.RequestHandler</a>(<a href="__builtin__.html#object">__builtin__.object</a>) |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 73 | </font></dt><dd> |
| 74 | <dl> |
| 75 | <dt><font face="helvetica, arial"><a href="oauth2client.appengine.html#OAuth2Handler">OAuth2Handler</a> |
| 76 | </font></dt></dl> |
| 77 | </dd> |
| 78 | <dt><font face="helvetica, arial"><a href="oauth2client.client.html#AssertionCredentials">oauth2client.client.AssertionCredentials</a>(<a href="oauth2client.client.html#OAuth2Credentials">oauth2client.client.OAuth2Credentials</a>) |
| 79 | </font></dt><dd> |
| 80 | <dl> |
| 81 | <dt><font face="helvetica, arial"><a href="oauth2client.appengine.html#AppAssertionCredentials">AppAssertionCredentials</a> |
| 82 | </font></dt></dl> |
| 83 | </dd> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 84 | <dt><font face="helvetica, arial"><a href="oauth2client.client.html#Storage">oauth2client.client.Storage</a>(<a href="__builtin__.html#object">__builtin__.object</a>) |
| 85 | </font></dt><dd> |
| 86 | <dl> |
| 87 | <dt><font face="helvetica, arial"><a href="oauth2client.appengine.html#StorageByKeyName">StorageByKeyName</a> |
| 88 | </font></dt></dl> |
| 89 | </dd> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 90 | </dl> |
| 91 | <p> |
| 92 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 93 | <tr bgcolor="#ffc8d8"> |
| 94 | <td colspan=3 valign=bottom> <br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 95 | <font color="#000000" face="helvetica, arial"><a name="AppAssertionCredentials">class <strong>AppAssertionCredentials</strong></a>(<a href="oauth2client.client.html#AssertionCredentials">oauth2client.client.AssertionCredentials</a>)</font></td></tr> |
| 96 | |
| 97 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 98 | <td colspan=2><tt>Credentials <a href="__builtin__.html#object">object</a> for App Engine Assertion Grants<br> |
| 99 | <br> |
| 100 | This <a href="__builtin__.html#object">object</a> will allow an App Engine application to identify itself to Google<br> |
| 101 | and other OAuth 2.0 servers that can verify assertions. It can be used for<br> |
| 102 | the purpose of accessing data stored under an account assigned to the App<br> |
| 103 | Engine application itself. The algorithm used for generating the assertion is<br> |
| 104 | the Signed JSON Web Token (JWT) algorithm. Additional details can be found at<br> |
| 105 | the following link:<br> |
| 106 | <br> |
| 107 | <a href="http://self-issued.info/docs/draft-jones-json-web-token.html">http://self-issued.info/docs/draft-jones-json-web-token.html</a><br> |
| 108 | <br> |
| 109 | This credential does not require a flow to instantiate because it represents<br> |
| 110 | a two legged flow, and therefore has all of the required information to<br> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 111 | generate and refresh its own access tokens.<br> </tt></td></tr> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 112 | <tr><td> </td> |
| 113 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 114 | <dd><a href="oauth2client.appengine.html#AppAssertionCredentials">AppAssertionCredentials</a></dd> |
| 115 | <dd><a href="oauth2client.client.html#AssertionCredentials">oauth2client.client.AssertionCredentials</a></dd> |
| 116 | <dd><a href="oauth2client.client.html#OAuth2Credentials">oauth2client.client.OAuth2Credentials</a></dd> |
| 117 | <dd><a href="oauth2client.client.html#Credentials">oauth2client.client.Credentials</a></dd> |
| 118 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 119 | </dl> |
| 120 | <hr> |
| 121 | Methods defined here:<br> |
Joe Gregorio | 0250385 | 2011-08-31 09:07:55 -0400 | [diff] [blame] | 122 | <dl><dt><a name="AppAssertionCredentials-__init__"><strong>__init__</strong></a>(self, scope, audience<font color="#909090">='https://accounts.google.com/o/oauth2/token'</font>, assertion_type<font color="#909090">='http://oauth.net/grant_type/jwt/1.0/bearer'</font>, token_uri<font color="#909090">='https://accounts.google.com/o/oauth2/token'</font>, **kwargs)</dt><dd><tt>Constructor for <a href="#AppAssertionCredentials">AppAssertionCredentials</a><br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 123 | <br> |
| 124 | Args:<br> |
| 125 | scope: string, scope of the credentials being requested.<br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 126 | audience: string, The audience, or verifier of the assertion. For<br> |
| 127 | convenience defaults to Google's audience.<br> |
| 128 | assertion_type: string, Type name that will identify the format of the<br> |
| 129 | assertion string. For convience, defaults to the JSON Web Token (JWT)<br> |
| 130 | assertion type string.<br> |
| 131 | token_uri: string, URI for token endpoint. For convenience<br> |
| 132 | defaults to Google's endpoints but any OAuth 2.0 provider can be used.</tt></dd></dl> |
| 133 | |
| 134 | <hr> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 135 | Class methods defined here:<br> |
| 136 | <dl><dt><a name="AppAssertionCredentials-from_json"><strong>from_json</strong></a>(cls, json)<font color="#909090"><font face="helvetica, arial"> from <a href="__builtin__.html#type">__builtin__.type</a></font></font></dt></dl> |
| 137 | |
| 138 | <hr> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 139 | Methods inherited from <a href="oauth2client.client.html#OAuth2Credentials">oauth2client.client.OAuth2Credentials</a>:<br> |
| 140 | <dl><dt><a name="AppAssertionCredentials-__getstate__"><strong>__getstate__</strong></a>(self)</dt><dd><tt>Trim the state down to something that can be pickled.</tt></dd></dl> |
| 141 | |
| 142 | <dl><dt><a name="AppAssertionCredentials-__setstate__"><strong>__setstate__</strong></a>(self, state)</dt><dd><tt>Reconstitute the state of the <a href="__builtin__.html#object">object</a> from being pickled.</tt></dd></dl> |
| 143 | |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 144 | <dl><dt><a name="AppAssertionCredentials-apply"><strong>apply</strong></a>(self, headers)</dt><dd><tt>Add the authorization to the headers.<br> |
| 145 | <br> |
| 146 | Args:<br> |
| 147 | headers: dict, the headers to add the Authorization header to.</tt></dd></dl> |
| 148 | |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 149 | <dl><dt><a name="AppAssertionCredentials-authorize"><strong>authorize</strong></a>(self, http)</dt><dd><tt>Authorize an httplib2.Http instance with these credentials.<br> |
| 150 | <br> |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 151 | The modified http.request method will add authentication headers to each<br> |
| 152 | request and will refresh access_tokens when a 401 is received on a<br> |
| 153 | request. In addition the http.request method has a credentials property,<br> |
| 154 | http.request.credentials, which is the Credentials <a href="__builtin__.html#object">object</a> that authorized<br> |
| 155 | it.<br> |
| 156 | <br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 157 | Args:<br> |
| 158 | http: An instance of httplib2.Http<br> |
| 159 | or something that acts like it.<br> |
| 160 | <br> |
| 161 | Returns:<br> |
| 162 | A modified instance of http that was passed in.<br> |
| 163 | <br> |
| 164 | Example:<br> |
| 165 | <br> |
| 166 | h = httplib2.Http()<br> |
| 167 | h = credentials.<a href="#AppAssertionCredentials-authorize">authorize</a>(h)<br> |
| 168 | <br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 169 | You can't create a new OAuth subclass of httplib2.Authenication<br> |
| 170 | because it never gets passed the absolute URI, which is needed for<br> |
| 171 | signing. So instead we have to overload 'request' with a closure<br> |
| 172 | that adds in the Authorization header and then calls the original<br> |
| 173 | version of 'request()'.</tt></dd></dl> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 174 | |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 175 | <dl><dt><a name="AppAssertionCredentials-refresh"><strong>refresh</strong></a>(self, http)</dt><dd><tt>Forces a refresh of the access_token.<br> |
| 176 | <br> |
| 177 | Args:<br> |
| 178 | http: httplib2.Http, an http <a href="__builtin__.html#object">object</a> to be used to make the refresh<br> |
| 179 | request.</tt></dd></dl> |
| 180 | |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 181 | <dl><dt><a name="AppAssertionCredentials-set_store"><strong>set_store</strong></a>(self, store)</dt><dd><tt>Set the <a href="oauth2client.client.html#Storage">Storage</a> for the credential.<br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 182 | <br> |
| 183 | Args:<br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 184 | store: <a href="oauth2client.client.html#Storage">Storage</a>, an implementation of Stroage <a href="__builtin__.html#object">object</a>.<br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 185 | This is needed to store the latest access_token if it<br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 186 | has expired and been refreshed. This implementation uses<br> |
| 187 | locking to check for updates before updating the<br> |
| 188 | access_token.</tt></dd></dl> |
| 189 | |
| 190 | <dl><dt><a name="AppAssertionCredentials-to_json"><strong>to_json</strong></a>(self)</dt></dl> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 191 | |
| 192 | <hr> |
| 193 | Data descriptors inherited from <a href="oauth2client.client.html#OAuth2Credentials">oauth2client.client.OAuth2Credentials</a>:<br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 194 | <dl><dt><strong>access_token_expired</strong></dt> |
| 195 | <dd><tt>True if the credential is expired or invalid.<br> |
| 196 | <br> |
| 197 | If the token_expiry isn't set, we assume the token doesn't expire.</tt></dd> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 198 | </dl> |
| 199 | <hr> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 200 | Class methods inherited from <a href="oauth2client.client.html#Credentials">oauth2client.client.Credentials</a>:<br> |
| 201 | <dl><dt><a name="AppAssertionCredentials-new_from_json"><strong>new_from_json</strong></a>(cls, s)<font color="#909090"><font face="helvetica, arial"> from <a href="__builtin__.html#type">__builtin__.type</a></font></font></dt><dd><tt>Utility class method to instantiate a Credentials subclass from a JSON<br> |
| 202 | representation produced by <a href="#AppAssertionCredentials-to_json">to_json</a>().<br> |
| 203 | <br> |
| 204 | Args:<br> |
| 205 | s: string, JSON from <a href="#AppAssertionCredentials-to_json">to_json</a>().<br> |
| 206 | <br> |
| 207 | Returns:<br> |
| 208 | An instance of the subclass of Credentials that was serialized with<br> |
| 209 | <a href="#AppAssertionCredentials-to_json">to_json</a>().</tt></dd></dl> |
| 210 | |
| 211 | <hr> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 212 | Data descriptors inherited from <a href="oauth2client.client.html#Credentials">oauth2client.client.Credentials</a>:<br> |
| 213 | <dl><dt><strong>__dict__</strong></dt> |
| 214 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 215 | </dl> |
| 216 | <dl><dt><strong>__weakref__</strong></dt> |
| 217 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 218 | </dl> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 219 | <hr> |
| 220 | Data and other attributes inherited from <a href="oauth2client.client.html#Credentials">oauth2client.client.Credentials</a>:<br> |
| 221 | <dl><dt><strong>NON_SERIALIZED_MEMBERS</strong> = ['store']</dl> |
| 222 | |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 223 | </td></tr></table> <p> |
| 224 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 225 | <tr bgcolor="#ffc8d8"> |
| 226 | <td colspan=3 valign=bottom> <br> |
| 227 | <font color="#000000" face="helvetica, arial"><a name="CredentialsModel">class <strong>CredentialsModel</strong></a>(<a href="google.appengine.ext.db.html#Model">google.appengine.ext.db.Model</a>)</font></td></tr> |
| 228 | |
| 229 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 230 | <td colspan=2><tt><a href="oauth2client.client.html#Storage">Storage</a> for OAuth 2.0 Credentials<br> |
| 231 | <br> |
| 232 | <a href="oauth2client.client.html#Storage">Storage</a> of the model is keyed by the user.user_id().<br> </tt></td></tr> |
| 233 | <tr><td> </td> |
| 234 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 235 | <dd><a href="oauth2client.appengine.html#CredentialsModel">CredentialsModel</a></dd> |
| 236 | <dd><a href="google.appengine.ext.db.html#Model">google.appengine.ext.db.Model</a></dd> |
| 237 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 238 | </dl> |
| 239 | <hr> |
| 240 | Data descriptors defined here:<br> |
| 241 | <dl><dt><strong>credentials</strong></dt> |
| 242 | <dd><tt>App Engine datastore Property for Credentials.<br> |
| 243 | <br> |
| 244 | Utility property that allows easy storage and retrieval of<br> |
| 245 | oath2client.Credentials</tt></dd> |
| 246 | </dl> |
| 247 | <hr> |
| 248 | Methods inherited from <a href="google.appengine.ext.db.html#Model">google.appengine.ext.db.Model</a>:<br> |
| 249 | <dl><dt><a name="CredentialsModel-__init__"><strong>__init__</strong></a>(self, parent<font color="#909090">=None</font>, key_name<font color="#909090">=None</font>, _app<font color="#909090">=None</font>, _from_entity<font color="#909090">=False</font>, **kwds)</dt><dd><tt>Creates a new instance of this model.<br> |
| 250 | <br> |
| 251 | To create a new entity, you instantiate a model and then call <a href="#CredentialsModel-put">put</a>(),<br> |
| 252 | which saves the entity to the datastore:<br> |
| 253 | <br> |
| 254 | person = Person()<br> |
| 255 | person.name = 'Bret'<br> |
| 256 | person.<a href="#CredentialsModel-put">put</a>()<br> |
| 257 | <br> |
| 258 | You can initialize properties in the model in the constructor with keyword<br> |
| 259 | arguments:<br> |
| 260 | <br> |
| 261 | person = Person(name='Bret')<br> |
| 262 | <br> |
| 263 | We initialize all other properties to the default value (as defined by the<br> |
| 264 | properties in the model definition) if they are not provided in the<br> |
| 265 | constructor.<br> |
| 266 | <br> |
| 267 | Args:<br> |
| 268 | parent: Parent instance for this instance or None, indicating a top-<br> |
| 269 | level instance.<br> |
| 270 | key_name: Name for new model instance.<br> |
| 271 | _from_entity: Intentionally undocumented.<br> |
| 272 | kwds: Keyword arguments mapping to properties of model. Also:<br> |
| 273 | key: Key instance for this instance, if provided makes parent and<br> |
| 274 | key_name redundant (they do not need to be set but if they are<br> |
| 275 | they must match the key).</tt></dd></dl> |
| 276 | |
| 277 | <dl><dt><a name="CredentialsModel-delete"><strong>delete</strong></a>(self, **kwargs)</dt><dd><tt>Deletes this entity from the datastore.<br> |
| 278 | <br> |
| 279 | Args:<br> |
| 280 | config: datastore_rpc.Configuration to use for this request.<br> |
| 281 | <br> |
| 282 | Raises:<br> |
| 283 | TransactionFailedError if the data could not be committed.</tt></dd></dl> |
| 284 | |
| 285 | <dl><dt><a name="CredentialsModel-dynamic_properties"><strong>dynamic_properties</strong></a>(self)</dt><dd><tt>Returns a list of all dynamic properties defined for instance.</tt></dd></dl> |
| 286 | |
| 287 | <dl><dt><a name="CredentialsModel-has_key"><strong>has_key</strong></a>(self)</dt><dd><tt>Determine if this model instance has a complete key.<br> |
| 288 | <br> |
| 289 | When not using a fully self-assigned Key, ids are not assigned until the<br> |
| 290 | data is saved to the Datastore, but instances with a key name always have<br> |
| 291 | a full key.<br> |
| 292 | <br> |
| 293 | Returns:<br> |
| 294 | True if the <a href="__builtin__.html#object">object</a> has been persisted to the datastore or has a key<br> |
| 295 | or has a key_name, otherwise False.</tt></dd></dl> |
| 296 | |
| 297 | <dl><dt><a name="CredentialsModel-instance_properties"><strong>instance_properties</strong></a>(self)</dt><dd><tt>Alias for dyanmic_properties.</tt></dd></dl> |
| 298 | |
| 299 | <dl><dt><a name="CredentialsModel-is_saved"><strong>is_saved</strong></a>(self)</dt><dd><tt>Determine if entity is persisted in the datastore.<br> |
| 300 | <br> |
| 301 | New instances of <a href="google.appengine.ext.db.html#Model">Model</a> do not start out saved in the data. Objects which<br> |
| 302 | are saved to or loaded from the Datastore will have a True saved state.<br> |
| 303 | <br> |
| 304 | Returns:<br> |
| 305 | True if <a href="__builtin__.html#object">object</a> has been persisted to the datastore, otherwise False.</tt></dd></dl> |
| 306 | |
| 307 | <dl><dt><a name="CredentialsModel-key"><strong>key</strong></a>(self)</dt><dd><tt>Unique key for this entity.<br> |
| 308 | <br> |
| 309 | This property is only available if this entity is already stored in the<br> |
| 310 | datastore or if it has a full key, so it is available if this entity was<br> |
| 311 | fetched returned from a query, or after <a href="#CredentialsModel-put">put</a>() is called the first time<br> |
| 312 | for new entities, or if a complete key was given when constructed.<br> |
| 313 | <br> |
| 314 | Returns:<br> |
| 315 | Datastore key of persisted entity.<br> |
| 316 | <br> |
| 317 | Raises:<br> |
| 318 | NotSavedError when entity is not persistent.</tt></dd></dl> |
| 319 | |
| 320 | <dl><dt><a name="CredentialsModel-parent"><strong>parent</strong></a>(self)</dt><dd><tt>Get the parent of the model instance.<br> |
| 321 | <br> |
| 322 | Returns:<br> |
| 323 | Parent of contained entity or parent provided in constructor, None if<br> |
| 324 | instance has no parent.</tt></dd></dl> |
| 325 | |
| 326 | <dl><dt><a name="CredentialsModel-parent_key"><strong>parent_key</strong></a>(self)</dt><dd><tt>Get the parent's key.<br> |
| 327 | <br> |
| 328 | This method is useful for avoiding a potential fetch from the datastore<br> |
| 329 | but still get information about the instances parent.<br> |
| 330 | <br> |
| 331 | Returns:<br> |
| 332 | Parent key of entity, None if there is no parent.</tt></dd></dl> |
| 333 | |
| 334 | <dl><dt><a name="CredentialsModel-put"><strong>put</strong></a>(self, **kwargs)</dt><dd><tt>Writes this model instance to the datastore.<br> |
| 335 | <br> |
| 336 | If this instance is new, we add an entity to the datastore.<br> |
| 337 | Otherwise, we update this instance, and the key will remain the<br> |
| 338 | same.<br> |
| 339 | <br> |
| 340 | Args:<br> |
| 341 | config: datastore_rpc.Configuration to use for this request.<br> |
| 342 | <br> |
| 343 | Returns:<br> |
| 344 | The key of the instance (either the existing key or a new key).<br> |
| 345 | <br> |
| 346 | Raises:<br> |
| 347 | TransactionFailedError if the data could not be committed.</tt></dd></dl> |
| 348 | |
| 349 | <dl><dt><a name="CredentialsModel-save"><strong>save</strong></a> = put(self, **kwargs)</dt><dd><tt>Writes this model instance to the datastore.<br> |
| 350 | <br> |
| 351 | If this instance is new, we add an entity to the datastore.<br> |
| 352 | Otherwise, we update this instance, and the key will remain the<br> |
| 353 | same.<br> |
| 354 | <br> |
| 355 | Args:<br> |
| 356 | config: datastore_rpc.Configuration to use for this request.<br> |
| 357 | <br> |
| 358 | Returns:<br> |
| 359 | The key of the instance (either the existing key or a new key).<br> |
| 360 | <br> |
| 361 | Raises:<br> |
| 362 | TransactionFailedError if the data could not be committed.</tt></dd></dl> |
| 363 | |
| 364 | <dl><dt><a name="CredentialsModel-to_xml"><strong>to_xml</strong></a>(self, _entity_class<font color="#909090">=<class 'google.appengine.api.datastore.Entity'></font>)</dt><dd><tt>Generate an XML representation of this model instance.<br> |
| 365 | <br> |
| 366 | atom and gd:namespace properties are converted to XML according to their<br> |
| 367 | respective schemas. For more information, see:<br> |
| 368 | <br> |
| 369 | <a href="http://www.atomenabled.org/developers/syndication/">http://www.atomenabled.org/developers/syndication/</a><br> |
| 370 | <a href="http://code.google.com/apis/gdata/common-elements.html">http://code.google.com/apis/gdata/common-elements.html</a></tt></dd></dl> |
| 371 | |
| 372 | <hr> |
| 373 | Class methods inherited from <a href="google.appengine.ext.db.html#Model">google.appengine.ext.db.Model</a>:<br> |
| 374 | <dl><dt><a name="CredentialsModel-all"><strong>all</strong></a>(cls, **kwds)<font color="#909090"><font face="helvetica, arial"> from <a href="google.appengine.ext.db.html#PropertiedClass">google.appengine.ext.db.PropertiedClass</a></font></font></dt><dd><tt>Returns a query over all instances of this model from the datastore.<br> |
| 375 | <br> |
| 376 | Returns:<br> |
| 377 | Query that will retrieve all instances from entity collection.</tt></dd></dl> |
| 378 | |
| 379 | <dl><dt><a name="CredentialsModel-entity_type"><strong>entity_type</strong></a>(cls)<font color="#909090"><font face="helvetica, arial"> from <a href="google.appengine.ext.db.html#PropertiedClass">google.appengine.ext.db.PropertiedClass</a></font></font></dt><dd><tt>Soon to be removed alias for kind.</tt></dd></dl> |
| 380 | |
| 381 | <dl><dt><a name="CredentialsModel-fields"><strong>fields</strong></a>(cls)<font color="#909090"><font face="helvetica, arial"> from <a href="google.appengine.ext.db.html#PropertiedClass">google.appengine.ext.db.PropertiedClass</a></font></font></dt><dd><tt>Soon to be removed alias for properties.</tt></dd></dl> |
| 382 | |
| 383 | <dl><dt><a name="CredentialsModel-from_entity"><strong>from_entity</strong></a>(cls, entity)<font color="#909090"><font face="helvetica, arial"> from <a href="google.appengine.ext.db.html#PropertiedClass">google.appengine.ext.db.PropertiedClass</a></font></font></dt><dd><tt>Converts the entity representation of this model to an instance.<br> |
| 384 | <br> |
| 385 | Converts datastore.Entity instance to an instance of cls.<br> |
| 386 | <br> |
| 387 | Args:<br> |
| 388 | entity: Entity loaded directly from datastore.<br> |
| 389 | <br> |
| 390 | Raises:<br> |
| 391 | KindError when cls is incorrect model for entity.</tt></dd></dl> |
| 392 | |
| 393 | <dl><dt><a name="CredentialsModel-get"><strong>get</strong></a>(cls, keys, **kwargs)<font color="#909090"><font face="helvetica, arial"> from <a href="google.appengine.ext.db.html#PropertiedClass">google.appengine.ext.db.PropertiedClass</a></font></font></dt><dd><tt>Fetch instance from the datastore of a specific <a href="google.appengine.ext.db.html#Model">Model</a> type using key.<br> |
| 394 | <br> |
| 395 | We support Key objects and string keys (we convert them to Key objects<br> |
| 396 | automatically).<br> |
| 397 | <br> |
| 398 | Useful for ensuring that specific instance types are retrieved from the<br> |
| 399 | datastore. It also helps that the source code clearly indicates what<br> |
| 400 | kind of <a href="__builtin__.html#object">object</a> is being retreived. Example:<br> |
| 401 | <br> |
| 402 | story = Story.<a href="#CredentialsModel-get">get</a>(story_key)<br> |
| 403 | <br> |
| 404 | Args:<br> |
| 405 | keys: Key within datastore entity collection to find; or string key;<br> |
| 406 | or list of Keys or string keys.<br> |
| 407 | config: datastore_rpc.Configuration to use for this request.<br> |
| 408 | <br> |
| 409 | Returns:<br> |
| 410 | If a single key was given: a <a href="google.appengine.ext.db.html#Model">Model</a> instance associated with key<br> |
| 411 | for provided class if it exists in the datastore, otherwise<br> |
| 412 | None; if a list of keys was given: a list whose items are either<br> |
| 413 | a <a href="google.appengine.ext.db.html#Model">Model</a> instance or None.<br> |
| 414 | <br> |
| 415 | Raises:<br> |
| 416 | KindError if any of the retreived objects are not instances of the<br> |
| 417 | type associated with call to 'get'.</tt></dd></dl> |
| 418 | |
| 419 | <dl><dt><a name="CredentialsModel-get_by_id"><strong>get_by_id</strong></a>(cls, ids, parent<font color="#909090">=None</font>, **kwargs)<font color="#909090"><font face="helvetica, arial"> from <a href="google.appengine.ext.db.html#PropertiedClass">google.appengine.ext.db.PropertiedClass</a></font></font></dt><dd><tt>Get instance of <a href="google.appengine.ext.db.html#Model">Model</a> class by id.<br> |
| 420 | <br> |
| 421 | Args:<br> |
| 422 | key_names: A single id or a list of ids.<br> |
| 423 | parent: Parent of instances to get. Can be a model or key.<br> |
| 424 | config: datastore_rpc.Configuration to use for this request.</tt></dd></dl> |
| 425 | |
| 426 | <dl><dt><a name="CredentialsModel-get_by_key_name"><strong>get_by_key_name</strong></a>(cls, key_names, parent<font color="#909090">=None</font>, **kwargs)<font color="#909090"><font face="helvetica, arial"> from <a href="google.appengine.ext.db.html#PropertiedClass">google.appengine.ext.db.PropertiedClass</a></font></font></dt><dd><tt>Get instance of <a href="google.appengine.ext.db.html#Model">Model</a> class by its key's name.<br> |
| 427 | <br> |
| 428 | Args:<br> |
| 429 | key_names: A single key-name or a list of key-names.<br> |
| 430 | parent: Parent of instances to get. Can be a model or key.<br> |
| 431 | config: datastore_rpc.Configuration to use for this request.</tt></dd></dl> |
| 432 | |
| 433 | <dl><dt><a name="CredentialsModel-get_or_insert"><strong>get_or_insert</strong></a>(cls, key_name, **kwds)<font color="#909090"><font face="helvetica, arial"> from <a href="google.appengine.ext.db.html#PropertiedClass">google.appengine.ext.db.PropertiedClass</a></font></font></dt><dd><tt>Transactionally retrieve or create an instance of <a href="google.appengine.ext.db.html#Model">Model</a> class.<br> |
| 434 | <br> |
| 435 | This acts much like the Python dictionary setdefault() method, where we<br> |
| 436 | first try to retrieve a <a href="google.appengine.ext.db.html#Model">Model</a> instance with the given key name and parent.<br> |
| 437 | If it's not present, then we create a new instance (using the *kwds<br> |
| 438 | supplied) and insert that with the supplied key name.<br> |
| 439 | <br> |
| 440 | Subsequent calls to this method with the same key_name and parent will<br> |
| 441 | always yield the same entity (though not the same actual <a href="__builtin__.html#object">object</a> instance),<br> |
| 442 | regardless of the *kwds supplied. If the specified entity has somehow<br> |
| 443 | been deleted separately, then the next call will create a new entity and<br> |
| 444 | return it.<br> |
| 445 | <br> |
| 446 | If the 'parent' keyword argument is supplied, it must be a <a href="google.appengine.ext.db.html#Model">Model</a> instance.<br> |
| 447 | It will be used as the parent of the new instance of this <a href="google.appengine.ext.db.html#Model">Model</a> class if<br> |
| 448 | one is created.<br> |
| 449 | <br> |
| 450 | This method is especially useful for having just one unique entity for<br> |
| 451 | a specific identifier. Insertion/retrieval is done transactionally, which<br> |
| 452 | guarantees uniqueness.<br> |
| 453 | <br> |
| 454 | Example usage:<br> |
| 455 | <br> |
| 456 | class WikiTopic(db.<a href="google.appengine.ext.db.html#Model">Model</a>):<br> |
| 457 | creation_date = db.DatetimeProperty(auto_now_add=True)<br> |
| 458 | body = db.TextProperty(required=True)<br> |
| 459 | <br> |
| 460 | # The first time through we'll create the new topic.<br> |
| 461 | wiki_word = 'CommonIdioms'<br> |
| 462 | topic = WikiTopic.<a href="#CredentialsModel-get_or_insert">get_or_insert</a>(wiki_word,<br> |
| 463 | body='This topic is totally new!')<br> |
| 464 | assert topic.<a href="#CredentialsModel-key">key</a>().name() == 'CommonIdioms'<br> |
| 465 | assert topic.body == 'This topic is totally new!'<br> |
| 466 | <br> |
| 467 | # The second time through will just retrieve the entity.<br> |
| 468 | overwrite_topic = WikiTopic.<a href="#CredentialsModel-get_or_insert">get_or_insert</a>(wiki_word,<br> |
| 469 | body='A totally different message!')<br> |
| 470 | assert topic.<a href="#CredentialsModel-key">key</a>().name() == 'CommonIdioms'<br> |
| 471 | assert topic.body == 'This topic is totally new!'<br> |
| 472 | <br> |
| 473 | Args:<br> |
| 474 | key_name: Key name to retrieve or create.<br> |
| 475 | **kwds: Keyword arguments to pass to the constructor of the model class<br> |
| 476 | if an instance for the specified key name does not already exist. If<br> |
| 477 | an instance with the supplied key_name and parent already exists, the<br> |
| 478 | rest of these arguments will be discarded.<br> |
| 479 | <br> |
| 480 | Returns:<br> |
| 481 | Existing instance of <a href="google.appengine.ext.db.html#Model">Model</a> class with the specified key_name and parent<br> |
| 482 | or a new one that has just been created.<br> |
| 483 | <br> |
| 484 | Raises:<br> |
| 485 | TransactionFailedError if the specified <a href="google.appengine.ext.db.html#Model">Model</a> instance could not be<br> |
| 486 | retrieved or created transactionally (due to high contention, etc).</tt></dd></dl> |
| 487 | |
| 488 | <dl><dt><a name="CredentialsModel-gql"><strong>gql</strong></a>(cls, query_string, *args, **kwds)<font color="#909090"><font face="helvetica, arial"> from <a href="google.appengine.ext.db.html#PropertiedClass">google.appengine.ext.db.PropertiedClass</a></font></font></dt><dd><tt>Returns a query using GQL query string.<br> |
| 489 | <br> |
| 490 | See appengine/ext/gql for more information about GQL.<br> |
| 491 | <br> |
| 492 | Args:<br> |
| 493 | query_string: properly formatted GQL query string with the<br> |
| 494 | 'SELECT * FROM <entity>' part omitted<br> |
| 495 | *args: rest of the positional arguments used to bind numeric references<br> |
| 496 | in the query.<br> |
| 497 | **kwds: dictionary-based arguments (for named parameters).</tt></dd></dl> |
| 498 | |
| 499 | <dl><dt><a name="CredentialsModel-kind"><strong>kind</strong></a>(cls)<font color="#909090"><font face="helvetica, arial"> from <a href="google.appengine.ext.db.html#PropertiedClass">google.appengine.ext.db.PropertiedClass</a></font></font></dt><dd><tt>Returns the datastore kind we use for this model.<br> |
| 500 | <br> |
| 501 | We just use the name of the model for now, ignoring potential collisions.</tt></dd></dl> |
| 502 | |
| 503 | <dl><dt><a name="CredentialsModel-properties"><strong>properties</strong></a>(cls)<font color="#909090"><font face="helvetica, arial"> from <a href="google.appengine.ext.db.html#PropertiedClass">google.appengine.ext.db.PropertiedClass</a></font></font></dt><dd><tt>Returns a dictionary of all the properties defined for this model.</tt></dd></dl> |
| 504 | |
| 505 | <hr> |
| 506 | Static methods inherited from <a href="google.appengine.ext.db.html#Model">google.appengine.ext.db.Model</a>:<br> |
| 507 | <dl><dt><a name="CredentialsModel-__new__"><strong>__new__</strong></a>(*args, **unused_kwds)</dt><dd><tt>Allow subclasses to call <a href="#CredentialsModel-__new__">__new__</a>() with arguments.<br> |
| 508 | <br> |
| 509 | Do NOT list 'cls' as the first argument, or in the case when<br> |
| 510 | the 'unused_kwds' dictionary contains the key 'cls', the function<br> |
| 511 | will complain about multiple argument values for 'cls'.<br> |
| 512 | <br> |
| 513 | Raises:<br> |
| 514 | TypeError if there are no positional arguments.</tt></dd></dl> |
| 515 | |
| 516 | <hr> |
| 517 | Data descriptors inherited from <a href="google.appengine.ext.db.html#Model">google.appengine.ext.db.Model</a>:<br> |
| 518 | <dl><dt><strong>__dict__</strong></dt> |
| 519 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 520 | </dl> |
| 521 | <dl><dt><strong>__weakref__</strong></dt> |
| 522 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 523 | </dl> |
| 524 | <hr> |
| 525 | Data and other attributes inherited from <a href="google.appengine.ext.db.html#Model">google.appengine.ext.db.Model</a>:<br> |
| 526 | <dl><dt><strong>__metaclass__</strong> = <class 'google.appengine.ext.db.PropertiedClass'><dd><tt>Meta-class for initializing <a href="google.appengine.ext.db.html#Model">Model</a> classes properties.<br> |
| 527 | <br> |
| 528 | Used for initializing Properties defined in the context of a model.<br> |
| 529 | By using a meta-class much of the configuration of a <a href="google.appengine.ext.db.html#Property">Property</a><br> |
| 530 | descriptor becomes implicit. By using this meta-class, descriptors<br> |
| 531 | that are of class <a href="google.appengine.ext.db.html#Model">Model</a> are notified about which class they<br> |
| 532 | belong to and what attribute they are associated with and can<br> |
| 533 | do appropriate initialization via __property_config__.<br> |
| 534 | <br> |
| 535 | Duplicate properties are not permitted.</tt></dl> |
| 536 | |
| 537 | </td></tr></table> <p> |
| 538 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 539 | <tr bgcolor="#ffc8d8"> |
| 540 | <td colspan=3 valign=bottom> <br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 541 | <font color="#000000" face="helvetica, arial"><a name="CredentialsProperty">class <strong>CredentialsProperty</strong></a>(<a href="google.appengine.ext.db.html#Property">google.appengine.ext.db.Property</a>)</font></td></tr> |
| 542 | |
| 543 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 544 | <td colspan=2><tt>App Engine datastore <a href="google.appengine.ext.db.html#Property">Property</a> for Credentials.<br> |
| 545 | <br> |
| 546 | Utility property that allows easy storage and retrieval of<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 547 | oath2client.Credentials<br> </tt></td></tr> |
| 548 | <tr><td> </td> |
| 549 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 550 | <dd><a href="oauth2client.appengine.html#CredentialsProperty">CredentialsProperty</a></dd> |
| 551 | <dd><a href="google.appengine.ext.db.html#Property">google.appengine.ext.db.Property</a></dd> |
| 552 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 553 | </dl> |
| 554 | <hr> |
| 555 | Methods defined here:<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 556 | <dl><dt><a name="CredentialsProperty-get_value_for_datastore"><strong>get_value_for_datastore</strong></a>(self, model_instance)</dt><dd><tt># For writing to datastore.</tt></dd></dl> |
| 557 | |
| 558 | <dl><dt><a name="CredentialsProperty-make_value_from_datastore"><strong>make_value_from_datastore</strong></a>(self, value)</dt><dd><tt># For reading from datastore.</tt></dd></dl> |
| 559 | |
| 560 | <dl><dt><a name="CredentialsProperty-validate"><strong>validate</strong></a>(self, value)</dt></dl> |
| 561 | |
| 562 | <hr> |
| 563 | Data and other attributes defined here:<br> |
| 564 | <dl><dt><strong>data_type</strong> = <class 'oauth2client.client.Credentials'><dd><tt>Base class for all Credentials objects.<br> |
| 565 | <br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 566 | Subclasses must define an authorize() method that applies the credentials to<br> |
| 567 | an HTTP transport.<br> |
| 568 | <br> |
| 569 | Subclasses must also specify a classmethod named 'from_json' that takes a JSON<br> |
| 570 | string as input and returns an instaniated Crentials <a href="__builtin__.html#object">object</a>.</tt></dl> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 571 | |
| 572 | <hr> |
| 573 | Methods inherited from <a href="google.appengine.ext.db.html#Property">google.appengine.ext.db.Property</a>:<br> |
| 574 | <dl><dt><a name="CredentialsProperty-__get__"><strong>__get__</strong></a>(self, model_instance, model_class)</dt><dd><tt>Returns the value for this property on the given model instance.<br> |
| 575 | <br> |
| 576 | See <a href="http://docs.python.org/ref/descriptors.html">http://docs.python.org/ref/descriptors.html</a> for a description of<br> |
| 577 | the arguments to this class and what they mean.</tt></dd></dl> |
| 578 | |
| 579 | <dl><dt><a name="CredentialsProperty-__init__"><strong>__init__</strong></a>(self, verbose_name<font color="#909090">=None</font>, name<font color="#909090">=None</font>, default<font color="#909090">=None</font>, required<font color="#909090">=False</font>, validator<font color="#909090">=None</font>, choices<font color="#909090">=None</font>, indexed<font color="#909090">=True</font>)</dt><dd><tt>Initializes this <a href="google.appengine.ext.db.html#Property">Property</a> with the given options.<br> |
| 580 | <br> |
| 581 | Args:<br> |
| 582 | verbose_name: User friendly name of property.<br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 583 | name: <a href="oauth2client.client.html#Storage">Storage</a> name for property. By default, uses attribute name<br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 584 | as it is assigned in the <a href="google.appengine.ext.db.html#Model">Model</a> sub-class.<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 585 | default: Default value for property if none is assigned.<br> |
| 586 | required: Whether property is required.<br> |
| 587 | validator: User provided method used for validation.<br> |
| 588 | choices: User provided set of valid property values.<br> |
| 589 | indexed: Whether property is indexed.</tt></dd></dl> |
| 590 | |
| 591 | <dl><dt><a name="CredentialsProperty-__property_config__"><strong>__property_config__</strong></a>(self, model_class, property_name)</dt><dd><tt>Configure property, connecting it to its model.<br> |
| 592 | <br> |
| 593 | Configure the property so that it knows its property name and what class<br> |
| 594 | it belongs to.<br> |
| 595 | <br> |
| 596 | Args:<br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 597 | model_class: <a href="google.appengine.ext.db.html#Model">Model</a> class which <a href="google.appengine.ext.db.html#Property">Property</a> will belong to.<br> |
| 598 | property_name: Name of property within <a href="google.appengine.ext.db.html#Model">Model</a> instance to store property<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 599 | values in. By default this will be the property name preceded by<br> |
| 600 | an underscore, but may change for different subclasses.</tt></dd></dl> |
| 601 | |
| 602 | <dl><dt><a name="CredentialsProperty-__set__"><strong>__set__</strong></a>(self, model_instance, value)</dt><dd><tt>Sets the value for this property on the given model instance.<br> |
| 603 | <br> |
| 604 | See <a href="http://docs.python.org/ref/descriptors.html">http://docs.python.org/ref/descriptors.html</a> for a description of<br> |
| 605 | the arguments to this class and what they mean.</tt></dd></dl> |
| 606 | |
| 607 | <dl><dt><a name="CredentialsProperty-datastore_type"><strong>datastore_type</strong></a>(self)</dt><dd><tt>Deprecated backwards-compatible accessor method for self.<strong>data_type</strong>.</tt></dd></dl> |
| 608 | |
| 609 | <dl><dt><a name="CredentialsProperty-default_value"><strong>default_value</strong></a>(self)</dt><dd><tt>Default value for unassigned values.<br> |
| 610 | <br> |
| 611 | Returns:<br> |
| 612 | Default value as provided by <a href="#CredentialsProperty-__init__">__init__</a>(default).</tt></dd></dl> |
| 613 | |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 614 | <dl><dt><a name="CredentialsProperty-empty"><strong>empty</strong></a>(self, value)</dt><dd><tt>Determine if value is empty in the context of this property.<br> |
| 615 | <br> |
| 616 | For most kinds, this is equivalent to "not value", but for kinds like<br> |
| 617 | bool, the test is more subtle, so subclasses can override this method<br> |
| 618 | if necessary.<br> |
| 619 | <br> |
| 620 | Args:<br> |
| 621 | value: Value to validate against this <a href="google.appengine.ext.db.html#Property">Property</a>.<br> |
| 622 | <br> |
| 623 | Returns:<br> |
| 624 | True if this value is considered empty in the context of this <a href="google.appengine.ext.db.html#Property">Property</a><br> |
| 625 | type, otherwise False.</tt></dd></dl> |
| 626 | |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 627 | <hr> |
| 628 | Data descriptors inherited from <a href="google.appengine.ext.db.html#Property">google.appengine.ext.db.Property</a>:<br> |
| 629 | <dl><dt><strong>__dict__</strong></dt> |
| 630 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 631 | </dl> |
| 632 | <dl><dt><strong>__weakref__</strong></dt> |
| 633 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 634 | </dl> |
| 635 | <hr> |
| 636 | Data and other attributes inherited from <a href="google.appengine.ext.db.html#Property">google.appengine.ext.db.Property</a>:<br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 637 | <dl><dt><strong>creation_counter</strong> = 1</dl> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 638 | |
| 639 | </td></tr></table> <p> |
| 640 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 641 | <tr bgcolor="#ffc8d8"> |
| 642 | <td colspan=3 valign=bottom> <br> |
| 643 | <font color="#000000" face="helvetica, arial"><a name="FlowProperty">class <strong>FlowProperty</strong></a>(<a href="google.appengine.ext.db.html#Property">google.appengine.ext.db.Property</a>)</font></td></tr> |
| 644 | |
| 645 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 646 | <td colspan=2><tt>App Engine datastore <a href="google.appengine.ext.db.html#Property">Property</a> for Flow.<br> |
| 647 | <br> |
| 648 | Utility property that allows easy storage and retreival of an<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 649 | oauth2client.Flow<br> </tt></td></tr> |
| 650 | <tr><td> </td> |
| 651 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 652 | <dd><a href="oauth2client.appengine.html#FlowProperty">FlowProperty</a></dd> |
| 653 | <dd><a href="google.appengine.ext.db.html#Property">google.appengine.ext.db.Property</a></dd> |
| 654 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 655 | </dl> |
| 656 | <hr> |
| 657 | Methods defined here:<br> |
| 658 | <dl><dt><a name="FlowProperty-empty"><strong>empty</strong></a>(self, value)</dt></dl> |
| 659 | |
| 660 | <dl><dt><a name="FlowProperty-get_value_for_datastore"><strong>get_value_for_datastore</strong></a>(self, model_instance)</dt><dd><tt># For writing to datastore.</tt></dd></dl> |
| 661 | |
| 662 | <dl><dt><a name="FlowProperty-make_value_from_datastore"><strong>make_value_from_datastore</strong></a>(self, value)</dt><dd><tt># For reading from datastore.</tt></dd></dl> |
| 663 | |
| 664 | <dl><dt><a name="FlowProperty-validate"><strong>validate</strong></a>(self, value)</dt></dl> |
| 665 | |
| 666 | <hr> |
| 667 | Data and other attributes defined here:<br> |
| 668 | <dl><dt><strong>data_type</strong> = <class 'oauth2client.client.Flow'><dd><tt>Base class for all Flow objects.</tt></dl> |
| 669 | |
| 670 | <hr> |
| 671 | Methods inherited from <a href="google.appengine.ext.db.html#Property">google.appengine.ext.db.Property</a>:<br> |
| 672 | <dl><dt><a name="FlowProperty-__get__"><strong>__get__</strong></a>(self, model_instance, model_class)</dt><dd><tt>Returns the value for this property on the given model instance.<br> |
| 673 | <br> |
| 674 | See <a href="http://docs.python.org/ref/descriptors.html">http://docs.python.org/ref/descriptors.html</a> for a description of<br> |
| 675 | the arguments to this class and what they mean.</tt></dd></dl> |
| 676 | |
| 677 | <dl><dt><a name="FlowProperty-__init__"><strong>__init__</strong></a>(self, verbose_name<font color="#909090">=None</font>, name<font color="#909090">=None</font>, default<font color="#909090">=None</font>, required<font color="#909090">=False</font>, validator<font color="#909090">=None</font>, choices<font color="#909090">=None</font>, indexed<font color="#909090">=True</font>)</dt><dd><tt>Initializes this <a href="google.appengine.ext.db.html#Property">Property</a> with the given options.<br> |
| 678 | <br> |
| 679 | Args:<br> |
| 680 | verbose_name: User friendly name of property.<br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 681 | name: <a href="oauth2client.client.html#Storage">Storage</a> name for property. By default, uses attribute name<br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 682 | as it is assigned in the <a href="google.appengine.ext.db.html#Model">Model</a> sub-class.<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 683 | default: Default value for property if none is assigned.<br> |
| 684 | required: Whether property is required.<br> |
| 685 | validator: User provided method used for validation.<br> |
| 686 | choices: User provided set of valid property values.<br> |
| 687 | indexed: Whether property is indexed.</tt></dd></dl> |
| 688 | |
| 689 | <dl><dt><a name="FlowProperty-__property_config__"><strong>__property_config__</strong></a>(self, model_class, property_name)</dt><dd><tt>Configure property, connecting it to its model.<br> |
| 690 | <br> |
| 691 | Configure the property so that it knows its property name and what class<br> |
| 692 | it belongs to.<br> |
| 693 | <br> |
| 694 | Args:<br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 695 | model_class: <a href="google.appengine.ext.db.html#Model">Model</a> class which <a href="google.appengine.ext.db.html#Property">Property</a> will belong to.<br> |
| 696 | property_name: Name of property within <a href="google.appengine.ext.db.html#Model">Model</a> instance to store property<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 697 | values in. By default this will be the property name preceded by<br> |
| 698 | an underscore, but may change for different subclasses.</tt></dd></dl> |
| 699 | |
| 700 | <dl><dt><a name="FlowProperty-__set__"><strong>__set__</strong></a>(self, model_instance, value)</dt><dd><tt>Sets the value for this property on the given model instance.<br> |
| 701 | <br> |
| 702 | See <a href="http://docs.python.org/ref/descriptors.html">http://docs.python.org/ref/descriptors.html</a> for a description of<br> |
| 703 | the arguments to this class and what they mean.</tt></dd></dl> |
| 704 | |
| 705 | <dl><dt><a name="FlowProperty-datastore_type"><strong>datastore_type</strong></a>(self)</dt><dd><tt>Deprecated backwards-compatible accessor method for self.<strong>data_type</strong>.</tt></dd></dl> |
| 706 | |
| 707 | <dl><dt><a name="FlowProperty-default_value"><strong>default_value</strong></a>(self)</dt><dd><tt>Default value for unassigned values.<br> |
| 708 | <br> |
| 709 | Returns:<br> |
| 710 | Default value as provided by <a href="#FlowProperty-__init__">__init__</a>(default).</tt></dd></dl> |
| 711 | |
| 712 | <hr> |
| 713 | Data descriptors inherited from <a href="google.appengine.ext.db.html#Property">google.appengine.ext.db.Property</a>:<br> |
| 714 | <dl><dt><strong>__dict__</strong></dt> |
| 715 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 716 | </dl> |
| 717 | <dl><dt><strong>__weakref__</strong></dt> |
| 718 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 719 | </dl> |
| 720 | <hr> |
| 721 | Data and other attributes inherited from <a href="google.appengine.ext.db.html#Property">google.appengine.ext.db.Property</a>:<br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 722 | <dl><dt><strong>creation_counter</strong> = 1</dl> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 723 | |
| 724 | </td></tr></table> <p> |
| 725 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 726 | <tr bgcolor="#ffc8d8"> |
| 727 | <td colspan=3 valign=bottom> <br> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 728 | <font color="#000000" face="helvetica, arial"><a name="InvalidClientSecretsError">class <strong>InvalidClientSecretsError</strong></a>(<a href="exceptions.html#Exception">exceptions.Exception</a>)</font></td></tr> |
| 729 | |
| 730 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 731 | <td colspan=2><tt>The client_secrets.json file is malformed or missing required fields.<br> </tt></td></tr> |
| 732 | <tr><td> </td> |
| 733 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 734 | <dd><a href="oauth2client.appengine.html#InvalidClientSecretsError">InvalidClientSecretsError</a></dd> |
| 735 | <dd><a href="exceptions.html#Exception">exceptions.Exception</a></dd> |
| 736 | <dd><a href="exceptions.html#BaseException">exceptions.BaseException</a></dd> |
| 737 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 738 | </dl> |
| 739 | <hr> |
| 740 | Data descriptors defined here:<br> |
| 741 | <dl><dt><strong>__weakref__</strong></dt> |
| 742 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 743 | </dl> |
| 744 | <hr> |
| 745 | Methods inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> |
| 746 | <dl><dt><a name="InvalidClientSecretsError-__init__"><strong>__init__</strong></a>(...)</dt><dd><tt>x.<a href="#InvalidClientSecretsError-__init__">__init__</a>(...) initializes x; see x.__class__.__doc__ for signature</tt></dd></dl> |
| 747 | |
| 748 | <hr> |
| 749 | Data and other attributes inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> |
| 750 | <dl><dt><strong>__new__</strong> = <built-in method __new__ of type object><dd><tt>T.<a href="#InvalidClientSecretsError-__new__">__new__</a>(S, ...) -> a new <a href="__builtin__.html#object">object</a> with type S, a subtype of T</tt></dl> |
| 751 | |
| 752 | <hr> |
| 753 | Methods inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> |
| 754 | <dl><dt><a name="InvalidClientSecretsError-__delattr__"><strong>__delattr__</strong></a>(...)</dt><dd><tt>x.<a href="#InvalidClientSecretsError-__delattr__">__delattr__</a>('name') <==> del x.name</tt></dd></dl> |
| 755 | |
| 756 | <dl><dt><a name="InvalidClientSecretsError-__getattribute__"><strong>__getattribute__</strong></a>(...)</dt><dd><tt>x.<a href="#InvalidClientSecretsError-__getattribute__">__getattribute__</a>('name') <==> x.name</tt></dd></dl> |
| 757 | |
| 758 | <dl><dt><a name="InvalidClientSecretsError-__getitem__"><strong>__getitem__</strong></a>(...)</dt><dd><tt>x.<a href="#InvalidClientSecretsError-__getitem__">__getitem__</a>(y) <==> x[y]</tt></dd></dl> |
| 759 | |
| 760 | <dl><dt><a name="InvalidClientSecretsError-__getslice__"><strong>__getslice__</strong></a>(...)</dt><dd><tt>x.<a href="#InvalidClientSecretsError-__getslice__">__getslice__</a>(i, j) <==> x[i:j]<br> |
| 761 | <br> |
| 762 | Use of negative indices is not supported.</tt></dd></dl> |
| 763 | |
| 764 | <dl><dt><a name="InvalidClientSecretsError-__reduce__"><strong>__reduce__</strong></a>(...)</dt></dl> |
| 765 | |
| 766 | <dl><dt><a name="InvalidClientSecretsError-__repr__"><strong>__repr__</strong></a>(...)</dt><dd><tt>x.<a href="#InvalidClientSecretsError-__repr__">__repr__</a>() <==> repr(x)</tt></dd></dl> |
| 767 | |
| 768 | <dl><dt><a name="InvalidClientSecretsError-__setattr__"><strong>__setattr__</strong></a>(...)</dt><dd><tt>x.<a href="#InvalidClientSecretsError-__setattr__">__setattr__</a>('name', value) <==> x.name = value</tt></dd></dl> |
| 769 | |
| 770 | <dl><dt><a name="InvalidClientSecretsError-__setstate__"><strong>__setstate__</strong></a>(...)</dt></dl> |
| 771 | |
| 772 | <dl><dt><a name="InvalidClientSecretsError-__str__"><strong>__str__</strong></a>(...)</dt><dd><tt>x.<a href="#InvalidClientSecretsError-__str__">__str__</a>() <==> str(x)</tt></dd></dl> |
| 773 | |
| 774 | <dl><dt><a name="InvalidClientSecretsError-__unicode__"><strong>__unicode__</strong></a>(...)</dt></dl> |
| 775 | |
| 776 | <hr> |
| 777 | Data descriptors inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> |
| 778 | <dl><dt><strong>__dict__</strong></dt> |
| 779 | </dl> |
| 780 | <dl><dt><strong>args</strong></dt> |
| 781 | </dl> |
| 782 | <dl><dt><strong>message</strong></dt> |
| 783 | </dl> |
| 784 | </td></tr></table> <p> |
| 785 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 786 | <tr bgcolor="#ffc8d8"> |
| 787 | <td colspan=3 valign=bottom> <br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 788 | <font color="#000000" face="helvetica, arial"><a name="OAuth2Decorator">class <strong>OAuth2Decorator</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr> |
| 789 | |
| 790 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 791 | <td colspan=2><tt>Utility for making OAuth 2.0 easier.<br> |
| 792 | <br> |
| 793 | Instantiate and then use with oauth_required or oauth_aware<br> |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 794 | as decorators on webapp.<a href="google.appengine.ext.webapp.html#RequestHandler">RequestHandler</a> methods.<br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 795 | <br> |
| 796 | Example:<br> |
| 797 | <br> |
| 798 | decorator = <a href="#OAuth2Decorator">OAuth2Decorator</a>(<br> |
| 799 | client_id='837...ent.com',<br> |
| 800 | client_secret='Qh...wwI',<br> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 801 | scope='https://www.googleapis.com/auth/plus')<br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 802 | <br> |
| 803 | <br> |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 804 | class MainHandler(webapp.<a href="google.appengine.ext.webapp.html#RequestHandler">RequestHandler</a>):<br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 805 | <br> |
| 806 | @decorator.oauth_required<br> |
| 807 | def get(self):<br> |
| 808 | http = decorator.<a href="#OAuth2Decorator-http">http</a>()<br> |
| 809 | # http is authorized with the user's Credentials and can be used<br> |
| 810 | # in API calls<br> </tt></td></tr> |
| 811 | <tr><td> </td> |
| 812 | <td width="100%">Methods defined here:<br> |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 813 | <dl><dt><a name="OAuth2Decorator-__init__"><strong>__init__</strong></a>(self, client_id, client_secret, scope, auth_uri<font color="#909090">='https://accounts.google.com/o/oauth2/auth'</font>, token_uri<font color="#909090">='https://accounts.google.com/o/oauth2/token'</font>, user_agent<font color="#909090">=None</font>, message<font color="#909090">=None</font>, **kwargs)</dt><dd><tt>Constructor for <a href="#OAuth2Decorator">OAuth2Decorator</a><br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 814 | <br> |
| 815 | Args:<br> |
| 816 | client_id: string, client identifier.<br> |
| 817 | client_secret: string client secret.<br> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 818 | scope: string or list of strings, scope(s) of the credentials being<br> |
| 819 | requested.<br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 820 | auth_uri: string, URI for authorization endpoint. For convenience<br> |
| 821 | defaults to Google's endpoints but any OAuth 2.0 provider can be used.<br> |
| 822 | token_uri: string, URI for token endpoint. For convenience<br> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 823 | defaults to Google's endpoints but any OAuth 2.0 provider can be used.<br> |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 824 | user_agent: string, User agent of your application, default to None.<br> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 825 | message: Message to display if there are problems with the OAuth 2.0<br> |
| 826 | configuration. The message may contain HTML and will be presented on the<br> |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 827 | web interface for any method that uses the decorator.<br> |
| 828 | **kwargs: dict, Keyword arguments are be passed along as kwargs to the<br> |
| 829 | OAuth2WebServerFlow constructor.</tt></dd></dl> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 830 | |
| 831 | <dl><dt><a name="OAuth2Decorator-authorize_url"><strong>authorize_url</strong></a>(self)</dt><dd><tt>Returns the URL to start the OAuth dance.<br> |
| 832 | <br> |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 833 | Must only be called from with a webapp.<a href="google.appengine.ext.webapp.html#RequestHandler">RequestHandler</a> subclassed method<br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 834 | that had been decorated with either @oauth_required or @oauth_aware.</tt></dd></dl> |
| 835 | |
| 836 | <dl><dt><a name="OAuth2Decorator-has_credentials"><strong>has_credentials</strong></a>(self)</dt><dd><tt>True if for the logged in user there are valid access Credentials.<br> |
| 837 | <br> |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 838 | Must only be called from with a webapp.<a href="google.appengine.ext.webapp.html#RequestHandler">RequestHandler</a> subclassed method<br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 839 | that had been decorated with either @oauth_required or @oauth_aware.</tt></dd></dl> |
| 840 | |
| 841 | <dl><dt><a name="OAuth2Decorator-http"><strong>http</strong></a>(self)</dt><dd><tt>Returns an authorized http instance.<br> |
| 842 | <br> |
| 843 | Must only be called from within an @oauth_required decorated method, or<br> |
| 844 | from within an @oauth_aware decorated method where <a href="#OAuth2Decorator-has_credentials">has_credentials</a>()<br> |
| 845 | returns True.</tt></dd></dl> |
| 846 | |
| 847 | <dl><dt><a name="OAuth2Decorator-oauth_aware"><strong>oauth_aware</strong></a>(self, method)</dt><dd><tt>Decorator that sets up for OAuth 2.0 dance, but doesn't do it.<br> |
| 848 | <br> |
| 849 | Does all the setup for the OAuth dance, but doesn't initiate it.<br> |
| 850 | This decorator is useful if you want to create a page that knows<br> |
| 851 | whether or not the user has granted access to this application.<br> |
| 852 | From within a method decorated with @oauth_aware the <a href="#OAuth2Decorator-has_credentials">has_credentials</a>()<br> |
| 853 | and <a href="#OAuth2Decorator-authorize_url">authorize_url</a>() methods can be called.<br> |
| 854 | <br> |
| 855 | Args:<br> |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 856 | method: callable, to be decorated method of a webapp.<a href="google.appengine.ext.webapp.html#RequestHandler">RequestHandler</a><br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 857 | instance.</tt></dd></dl> |
| 858 | |
| 859 | <dl><dt><a name="OAuth2Decorator-oauth_required"><strong>oauth_required</strong></a>(self, method)</dt><dd><tt>Decorator that starts the OAuth 2.0 dance.<br> |
| 860 | <br> |
| 861 | Starts the OAuth dance for the logged in user if they haven't already<br> |
| 862 | granted access for this application.<br> |
| 863 | <br> |
| 864 | Args:<br> |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 865 | method: callable, to be decorated method of a webapp.<a href="google.appengine.ext.webapp.html#RequestHandler">RequestHandler</a><br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 866 | instance.</tt></dd></dl> |
| 867 | |
| 868 | <hr> |
| 869 | Data descriptors defined here:<br> |
| 870 | <dl><dt><strong>__dict__</strong></dt> |
| 871 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 872 | </dl> |
| 873 | <dl><dt><strong>__weakref__</strong></dt> |
| 874 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 875 | </dl> |
| 876 | </td></tr></table> <p> |
| 877 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 878 | <tr bgcolor="#ffc8d8"> |
| 879 | <td colspan=3 valign=bottom> <br> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 880 | <font color="#000000" face="helvetica, arial"><a name="OAuth2DecoratorFromClientSecrets">class <strong>OAuth2DecoratorFromClientSecrets</strong></a>(<a href="oauth2client.appengine.html#OAuth2Decorator">OAuth2Decorator</a>)</font></td></tr> |
| 881 | |
| 882 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 883 | <td colspan=2><tt>An <a href="#OAuth2Decorator">OAuth2Decorator</a> that builds from a clientsecrets file.<br> |
| 884 | <br> |
| 885 | Uses a clientsecrets file as the source for all the information when<br> |
| 886 | constructing an <a href="#OAuth2Decorator">OAuth2Decorator</a>.<br> |
| 887 | <br> |
| 888 | Example:<br> |
| 889 | <br> |
| 890 | decorator = <a href="#OAuth2DecoratorFromClientSecrets">OAuth2DecoratorFromClientSecrets</a>(<br> |
| 891 | os.path.join(os.path.dirname(__file__), 'client_secrets.json')<br> |
| 892 | scope='https://www.googleapis.com/auth/plus')<br> |
| 893 | <br> |
| 894 | <br> |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 895 | class MainHandler(webapp.<a href="google.appengine.ext.webapp.html#RequestHandler">RequestHandler</a>):<br> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 896 | <br> |
| 897 | @decorator.oauth_required<br> |
| 898 | def get(self):<br> |
| 899 | http = decorator.<a href="#OAuth2DecoratorFromClientSecrets-http">http</a>()<br> |
| 900 | # http is authorized with the user's Credentials and can be used<br> |
| 901 | # in API calls<br> </tt></td></tr> |
| 902 | <tr><td> </td> |
| 903 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 904 | <dd><a href="oauth2client.appengine.html#OAuth2DecoratorFromClientSecrets">OAuth2DecoratorFromClientSecrets</a></dd> |
| 905 | <dd><a href="oauth2client.appengine.html#OAuth2Decorator">OAuth2Decorator</a></dd> |
| 906 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 907 | </dl> |
| 908 | <hr> |
| 909 | Methods defined here:<br> |
| 910 | <dl><dt><a name="OAuth2DecoratorFromClientSecrets-__init__"><strong>__init__</strong></a>(self, filename, scope, message<font color="#909090">=None</font>)</dt><dd><tt>Constructor<br> |
| 911 | <br> |
| 912 | Args:<br> |
| 913 | filename: string, File name of client secrets.<br> |
| 914 | scope: string, Space separated list of scopes.<br> |
| 915 | message: string, A friendly string to display to the user if the<br> |
| 916 | clientsecrets file is missing or invalid. The message may contain HTML and<br> |
| 917 | will be presented on the web interface for any method that uses the<br> |
| 918 | decorator.</tt></dd></dl> |
| 919 | |
| 920 | <hr> |
| 921 | Methods inherited from <a href="oauth2client.appengine.html#OAuth2Decorator">OAuth2Decorator</a>:<br> |
| 922 | <dl><dt><a name="OAuth2DecoratorFromClientSecrets-authorize_url"><strong>authorize_url</strong></a>(self)</dt><dd><tt>Returns the URL to start the OAuth dance.<br> |
| 923 | <br> |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 924 | Must only be called from with a webapp.<a href="google.appengine.ext.webapp.html#RequestHandler">RequestHandler</a> subclassed method<br> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 925 | that had been decorated with either @oauth_required or @oauth_aware.</tt></dd></dl> |
| 926 | |
| 927 | <dl><dt><a name="OAuth2DecoratorFromClientSecrets-has_credentials"><strong>has_credentials</strong></a>(self)</dt><dd><tt>True if for the logged in user there are valid access Credentials.<br> |
| 928 | <br> |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 929 | Must only be called from with a webapp.<a href="google.appengine.ext.webapp.html#RequestHandler">RequestHandler</a> subclassed method<br> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 930 | that had been decorated with either @oauth_required or @oauth_aware.</tt></dd></dl> |
| 931 | |
| 932 | <dl><dt><a name="OAuth2DecoratorFromClientSecrets-http"><strong>http</strong></a>(self)</dt><dd><tt>Returns an authorized http instance.<br> |
| 933 | <br> |
| 934 | Must only be called from within an @oauth_required decorated method, or<br> |
| 935 | from within an @oauth_aware decorated method where <a href="#OAuth2DecoratorFromClientSecrets-has_credentials">has_credentials</a>()<br> |
| 936 | returns True.</tt></dd></dl> |
| 937 | |
| 938 | <dl><dt><a name="OAuth2DecoratorFromClientSecrets-oauth_aware"><strong>oauth_aware</strong></a>(self, method)</dt><dd><tt>Decorator that sets up for OAuth 2.0 dance, but doesn't do it.<br> |
| 939 | <br> |
| 940 | Does all the setup for the OAuth dance, but doesn't initiate it.<br> |
| 941 | This decorator is useful if you want to create a page that knows<br> |
| 942 | whether or not the user has granted access to this application.<br> |
| 943 | From within a method decorated with @oauth_aware the <a href="#OAuth2DecoratorFromClientSecrets-has_credentials">has_credentials</a>()<br> |
| 944 | and <a href="#OAuth2DecoratorFromClientSecrets-authorize_url">authorize_url</a>() methods can be called.<br> |
| 945 | <br> |
| 946 | Args:<br> |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 947 | method: callable, to be decorated method of a webapp.<a href="google.appengine.ext.webapp.html#RequestHandler">RequestHandler</a><br> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 948 | instance.</tt></dd></dl> |
| 949 | |
| 950 | <dl><dt><a name="OAuth2DecoratorFromClientSecrets-oauth_required"><strong>oauth_required</strong></a>(self, method)</dt><dd><tt>Decorator that starts the OAuth 2.0 dance.<br> |
| 951 | <br> |
| 952 | Starts the OAuth dance for the logged in user if they haven't already<br> |
| 953 | granted access for this application.<br> |
| 954 | <br> |
| 955 | Args:<br> |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 956 | method: callable, to be decorated method of a webapp.<a href="google.appengine.ext.webapp.html#RequestHandler">RequestHandler</a><br> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 957 | instance.</tt></dd></dl> |
| 958 | |
| 959 | <hr> |
| 960 | Data descriptors inherited from <a href="oauth2client.appengine.html#OAuth2Decorator">OAuth2Decorator</a>:<br> |
| 961 | <dl><dt><strong>__dict__</strong></dt> |
| 962 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 963 | </dl> |
| 964 | <dl><dt><strong>__weakref__</strong></dt> |
| 965 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 966 | </dl> |
| 967 | </td></tr></table> <p> |
| 968 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 969 | <tr bgcolor="#ffc8d8"> |
| 970 | <td colspan=3 valign=bottom> <br> |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 971 | <font color="#000000" face="helvetica, arial"><a name="OAuth2Handler">class <strong>OAuth2Handler</strong></a>(<a href="google.appengine.ext.webapp.html#RequestHandler">google.appengine.ext.webapp.RequestHandler</a>)</font></td></tr> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 972 | |
| 973 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 974 | <td colspan=2><tt>Handler for the redirect_uri of the OAuth 2.0 dance.<br> </tt></td></tr> |
| 975 | <tr><td> </td> |
| 976 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 977 | <dd><a href="oauth2client.appengine.html#OAuth2Handler">OAuth2Handler</a></dd> |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 978 | <dd><a href="google.appengine.ext.webapp.html#RequestHandler">google.appengine.ext.webapp.RequestHandler</a></dd> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 979 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 980 | </dl> |
| 981 | <hr> |
| 982 | Methods defined here:<br> |
| 983 | <dl><dt><a name="OAuth2Handler-get"><strong>get</strong></a> = check_login(self, *args)</dt></dl> |
| 984 | |
| 985 | <hr> |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 986 | Methods inherited from <a href="google.appengine.ext.webapp.html#RequestHandler">google.appengine.ext.webapp.RequestHandler</a>:<br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 987 | <dl><dt><a name="OAuth2Handler-delete"><strong>delete</strong></a>(self, *args)</dt><dd><tt>Handler method for DELETE requests.</tt></dd></dl> |
| 988 | |
| 989 | <dl><dt><a name="OAuth2Handler-error"><strong>error</strong></a>(self, code)</dt><dd><tt>Clears the response output stream and sets the given HTTP error code.<br> |
| 990 | <br> |
| 991 | Args:<br> |
| 992 | code: the HTTP status error code (e.g., 501)</tt></dd></dl> |
| 993 | |
| 994 | <dl><dt><a name="OAuth2Handler-handle_exception"><strong>handle_exception</strong></a>(self, exception, debug_mode)</dt><dd><tt>Called if this handler throws an exception during execution.<br> |
| 995 | <br> |
| 996 | The default behavior is to call <a href="#OAuth2Handler-error">error</a>(500) and print a stack trace<br> |
| 997 | if debug_mode is True.<br> |
| 998 | <br> |
| 999 | Args:<br> |
| 1000 | exception: the exception that was thrown<br> |
| 1001 | debug_mode: True if the web application is running in debug mode</tt></dd></dl> |
| 1002 | |
| 1003 | <dl><dt><a name="OAuth2Handler-head"><strong>head</strong></a>(self, *args)</dt><dd><tt>Handler method for HEAD requests.</tt></dd></dl> |
| 1004 | |
| 1005 | <dl><dt><a name="OAuth2Handler-initialize"><strong>initialize</strong></a>(self, request, response)</dt><dd><tt>Initializes this request handler with the given Request and Response.</tt></dd></dl> |
| 1006 | |
| 1007 | <dl><dt><a name="OAuth2Handler-options"><strong>options</strong></a>(self, *args)</dt><dd><tt>Handler method for OPTIONS requests.</tt></dd></dl> |
| 1008 | |
| 1009 | <dl><dt><a name="OAuth2Handler-post"><strong>post</strong></a>(self, *args)</dt><dd><tt>Handler method for POST requests.</tt></dd></dl> |
| 1010 | |
| 1011 | <dl><dt><a name="OAuth2Handler-put"><strong>put</strong></a>(self, *args)</dt><dd><tt>Handler method for PUT requests.</tt></dd></dl> |
| 1012 | |
| 1013 | <dl><dt><a name="OAuth2Handler-redirect"><strong>redirect</strong></a>(self, uri, permanent<font color="#909090">=False</font>)</dt><dd><tt>Issues an HTTP redirect to the given relative URL.<br> |
| 1014 | <br> |
| 1015 | Args:<br> |
| 1016 | uri: a relative or absolute URI (e.g., '../flowers.html')<br> |
| 1017 | permanent: if true, we use a 301 redirect instead of a 302 redirect</tt></dd></dl> |
| 1018 | |
| 1019 | <dl><dt><a name="OAuth2Handler-trace"><strong>trace</strong></a>(self, *args)</dt><dd><tt>Handler method for TRACE requests.</tt></dd></dl> |
| 1020 | |
| 1021 | <hr> |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 1022 | Class methods inherited from <a href="google.appengine.ext.webapp.html#RequestHandler">google.appengine.ext.webapp.RequestHandler</a>:<br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 1023 | <dl><dt><a name="OAuth2Handler-get_url"><strong>get_url</strong></a>(cls, *args, **kargs)<font color="#909090"><font face="helvetica, arial"> from <a href="__builtin__.html#type">__builtin__.type</a></font></font></dt><dd><tt>Returns the url for the given handler.<br> |
| 1024 | <br> |
| 1025 | The default implementation uses the patterns passed to the active<br> |
| 1026 | WSGIApplication to create a url. However, it is different from Django's<br> |
| 1027 | urlresolvers.reverse() in the following ways:<br> |
| 1028 | - It does not try to resolve handlers via module loading<br> |
| 1029 | - It does not support named arguments<br> |
| 1030 | - It performs some post-prosessing on the url to remove some regex<br> |
| 1031 | operators.<br> |
| 1032 | - It will try to fill in the left-most missing arguments with the args<br> |
| 1033 | used in the active request.<br> |
| 1034 | <br> |
| 1035 | Args:<br> |
| 1036 | args: Parameters for the url pattern's groups.<br> |
| 1037 | kwargs: Optionally contains 'implicit_args' that can either be a boolean<br> |
| 1038 | or a tuple. When it is True, it will use the arguments to the<br> |
| 1039 | active request as implicit arguments. When it is False (default),<br> |
| 1040 | it will not use any implicit arguments. When it is a tuple, it<br> |
| 1041 | will use the tuple as the implicit arguments.<br> |
| 1042 | the left-most args if some are missing from args.<br> |
| 1043 | <br> |
| 1044 | Returns:<br> |
| 1045 | The url for this handler/args combination.<br> |
| 1046 | <br> |
| 1047 | Raises:<br> |
| 1048 | NoUrlFoundError: No url pattern for this handler has the same<br> |
| 1049 | number of args that were passed in.</tt></dd></dl> |
| 1050 | |
| 1051 | <dl><dt><a name="OAuth2Handler-new_factory"><strong>new_factory</strong></a>(cls, *args, **kwargs)<font color="#909090"><font face="helvetica, arial"> from <a href="__builtin__.html#type">__builtin__.type</a></font></font></dt><dd><tt>Create new request handler factory.<br> |
| 1052 | <br> |
| 1053 | Use factory method to create reusable request handlers that just<br> |
| 1054 | require a few configuration parameters to construct. Also useful<br> |
| 1055 | for injecting shared state between multiple request handler<br> |
| 1056 | instances without relying on global variables. For example, to<br> |
| 1057 | create a set of post handlers that will do simple text transformations<br> |
| 1058 | you can write:<br> |
| 1059 | <br> |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 1060 | class ChangeTextHandler(webapp.<a href="google.appengine.ext.webapp.html#RequestHandler">RequestHandler</a>):<br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 1061 | <br> |
| 1062 | def <a href="#OAuth2Handler-__init__">__init__</a>(self, transform):<br> |
| 1063 | self.<strong>transform</strong> = transform<br> |
| 1064 | <br> |
| 1065 | def <a href="#OAuth2Handler-post">post</a>(self):<br> |
| 1066 | response_text = transform(<br> |
| 1067 | self.<strong>request</strong>.request.body_file.getvalue())<br> |
| 1068 | self.<strong>response</strong>.out.write(response_text)<br> |
| 1069 | <br> |
| 1070 | application = webapp.WSGIApplication(<br> |
| 1071 | [('/to_lower', ChangeTextHandler.<a href="#OAuth2Handler-new_factory">new_factory</a>(str.lower)),<br> |
| 1072 | ('/to_upper', ChangeTextHandler.<a href="#OAuth2Handler-new_factory">new_factory</a>(str.upper)),<br> |
| 1073 | ],<br> |
| 1074 | debug=True)<br> |
| 1075 | <br> |
| 1076 | Text POSTed to /to_lower will be lower cased.<br> |
| 1077 | Text POSTed to /to_upper will be upper cased.</tt></dd></dl> |
| 1078 | |
| 1079 | <hr> |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 1080 | Data descriptors inherited from <a href="google.appengine.ext.webapp.html#RequestHandler">google.appengine.ext.webapp.RequestHandler</a>:<br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 1081 | <dl><dt><strong>__dict__</strong></dt> |
| 1082 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 1083 | </dl> |
| 1084 | <dl><dt><strong>__weakref__</strong></dt> |
| 1085 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 1086 | </dl> |
| 1087 | </td></tr></table> <p> |
| 1088 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 1089 | <tr bgcolor="#ffc8d8"> |
| 1090 | <td colspan=3 valign=bottom> <br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 1091 | <font color="#000000" face="helvetica, arial"><a name="StorageByKeyName">class <strong>StorageByKeyName</strong></a>(<a href="oauth2client.client.html#Storage">oauth2client.client.Storage</a>)</font></td></tr> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 1092 | |
| 1093 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 1094 | <td colspan=2><tt>Store and retrieve a single credential to and from<br> |
| 1095 | the App Engine datastore.<br> |
| 1096 | <br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 1097 | This <a href="oauth2client.client.html#Storage">Storage</a> helper presumes the Credentials<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 1098 | have been stored as a CredenialsProperty<br> |
| 1099 | on a datastore model class, and that entities<br> |
| 1100 | are stored by key_name.<br> </tt></td></tr> |
| 1101 | <tr><td> </td> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 1102 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 1103 | <dd><a href="oauth2client.appengine.html#StorageByKeyName">StorageByKeyName</a></dd> |
| 1104 | <dd><a href="oauth2client.client.html#Storage">oauth2client.client.Storage</a></dd> |
| 1105 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 1106 | </dl> |
| 1107 | <hr> |
| 1108 | Methods defined here:<br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 1109 | <dl><dt><a name="StorageByKeyName-__init__"><strong>__init__</strong></a>(self, model, key_name, property_name, cache<font color="#909090">=None</font>)</dt><dd><tt>Constructor for <a href="oauth2client.client.html#Storage">Storage</a>.<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 1110 | <br> |
| 1111 | Args:<br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 1112 | model: db.<a href="google.appengine.ext.db.html#Model">Model</a>, model class<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 1113 | key_name: string, key name for the entity that has the credentials<br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 1114 | property_name: string, name of the property that is a <a href="#CredentialsProperty">CredentialsProperty</a><br> |
| 1115 | cache: memcache, a write-through cache to put in front of the datastore</tt></dd></dl> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 1116 | |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 1117 | <dl><dt><a name="StorageByKeyName-locked_delete"><strong>locked_delete</strong></a>(self)</dt><dd><tt>Delete Credential from datastore.</tt></dd></dl> |
| 1118 | |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 1119 | <dl><dt><a name="StorageByKeyName-locked_get"><strong>locked_get</strong></a>(self)</dt><dd><tt>Retrieve Credential from datastore.<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 1120 | <br> |
| 1121 | Returns:<br> |
| 1122 | oauth2client.Credentials</tt></dd></dl> |
| 1123 | |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 1124 | <dl><dt><a name="StorageByKeyName-locked_put"><strong>locked_put</strong></a>(self, credentials)</dt><dd><tt>Write a Credentials to the datastore.<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 1125 | <br> |
| 1126 | Args:<br> |
| 1127 | credentials: Credentials, the credentials to store.</tt></dd></dl> |
| 1128 | |
| 1129 | <hr> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 1130 | Methods inherited from <a href="oauth2client.client.html#Storage">oauth2client.client.Storage</a>:<br> |
| 1131 | <dl><dt><a name="StorageByKeyName-acquire_lock"><strong>acquire_lock</strong></a>(self)</dt><dd><tt>Acquires any lock necessary to access this <a href="oauth2client.client.html#Storage">Storage</a>.<br> |
| 1132 | <br> |
| 1133 | This lock is not reentrant.</tt></dd></dl> |
| 1134 | |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 1135 | <dl><dt><a name="StorageByKeyName-delete"><strong>delete</strong></a>(self)</dt><dd><tt>Delete credential.<br> |
| 1136 | <br> |
| 1137 | Frees any resources associated with storing the credential.<br> |
| 1138 | The <a href="oauth2client.client.html#Storage">Storage</a> lock must *not* be held when this is called.<br> |
| 1139 | <br> |
| 1140 | Returns:<br> |
| 1141 | None</tt></dd></dl> |
| 1142 | |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 1143 | <dl><dt><a name="StorageByKeyName-get"><strong>get</strong></a>(self)</dt><dd><tt>Retrieve credential.<br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 1144 | <br> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 1145 | The <a href="oauth2client.client.html#Storage">Storage</a> lock must *not* be held when this is called.<br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 1146 | <br> |
| 1147 | Returns:<br> |
| 1148 | oauth2client.client.Credentials</tt></dd></dl> |
| 1149 | |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 1150 | <dl><dt><a name="StorageByKeyName-put"><strong>put</strong></a>(self, credentials)</dt><dd><tt>Write a credential.<br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 1151 | <br> |
| 1152 | The <a href="oauth2client.client.html#Storage">Storage</a> lock must be held when this is called.<br> |
| 1153 | <br> |
| 1154 | Args:<br> |
| 1155 | credentials: Credentials, the credentials to store.</tt></dd></dl> |
| 1156 | |
| 1157 | <dl><dt><a name="StorageByKeyName-release_lock"><strong>release_lock</strong></a>(self)</dt><dd><tt>Release the <a href="oauth2client.client.html#Storage">Storage</a> lock.<br> |
| 1158 | <br> |
| 1159 | Trying to release a lock that isn't held will result in a<br> |
| 1160 | RuntimeError.</tt></dd></dl> |
| 1161 | |
| 1162 | <hr> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 1163 | Data descriptors inherited from <a href="oauth2client.client.html#Storage">oauth2client.client.Storage</a>:<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 1164 | <dl><dt><strong>__dict__</strong></dt> |
| 1165 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 1166 | </dl> |
| 1167 | <dl><dt><strong>__weakref__</strong></dt> |
| 1168 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 1169 | </dl> |
| 1170 | </td></tr></table></td></tr></table><p> |
| 1171 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 1172 | <tr bgcolor="#eeaa77"> |
| 1173 | <td colspan=3 valign=bottom> <br> |
| 1174 | <font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr> |
| 1175 | |
| 1176 | <tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td> |
| 1177 | <td width="100%"><dl><dt><a name="-main"><strong>main</strong></a>()</dt></dl> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 1178 | <dl><dt><a name="-oauth2decorator_from_clientsecrets"><strong>oauth2decorator_from_clientsecrets</strong></a>(filename, scope, message<font color="#909090">=None</font>)</dt><dd><tt>Creates an <a href="#OAuth2Decorator">OAuth2Decorator</a> populated from a clientsecrets file.<br> |
| 1179 | <br> |
| 1180 | Args:<br> |
| 1181 | filename: string, File name of client secrets.<br> |
| 1182 | scope: string, Space separated list of scopes.<br> |
| 1183 | message: string, A friendly string to display to the user if the<br> |
| 1184 | clientsecrets file is missing or invalid. The message may contain HTML and<br> |
| 1185 | will be presented on the web interface for any method that uses the<br> |
| 1186 | decorator.<br> |
| 1187 | <br> |
| 1188 | Returns: An <a href="#OAuth2Decorator">OAuth2Decorator</a></tt></dd></dl> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 1189 | </td></tr></table><p> |
| 1190 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 1191 | <tr bgcolor="#55aa55"> |
| 1192 | <td colspan=3 valign=bottom> <br> |
| 1193 | <font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr> |
| 1194 | |
| 1195 | <tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 1196 | <td width="100%"><strong>OAUTH2CLIENT_NAMESPACE</strong> = 'oauth2client#ns'<br> |
| 1197 | <strong>__author__</strong> = 'jcgregorio@google.com (Joe Gregorio)'<br> |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 1198 | <strong>application</strong> = <google.appengine.ext.webapp.WSGIApplication object></td></tr></table><p> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 1199 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 1200 | <tr bgcolor="#7799ee"> |
| 1201 | <td colspan=3 valign=bottom> <br> |
| 1202 | <font color="#ffffff" face="helvetica, arial"><big><strong>Author</strong></big></font></td></tr> |
| 1203 | |
| 1204 | <tr><td bgcolor="#7799ee"><tt> </tt></td><td> </td> |
| 1205 | <td width="100%">jcgregorio@google.com (Joe Gregorio)</td></tr></table> |
| 1206 | </body></html> |