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