@@ -291,3 +291,44 @@ you add the correct scopes for the APIs you want to access:
291291 * ``https://www.googleapis.com/auth/devstorage.read_write ``
292292
293293.. _set up the GCE instance : https://cloud.google.com/compute/docs/authentication#using
294+
295+ Advanced Customization
296+ ======================
297+
298+ Though the ``gcloud-python `` library defaults to using `oauth2client `_
299+ to sign requests and ``httplib2 `` for sending requests,
300+ it is not a strict requirement.
301+
302+ The :class: `Client <gcloud.client.Client> ` constructor accepts an optional
303+ ``http `` argument in place of a ``credentials `` object.
304+ If passed, all HTTP requests made by the client will use your
305+ custom HTTP object.
306+
307+ In order for this to be possible,
308+ the ``http `` object must do two things:
309+
310+ * Handle authentication on its own
311+ * Define a method ``request() `` that can subsitute for
312+ :meth: `httplib2.Http.request `.
313+
314+ The entire signature from ``httplib2 `` need not be implemented,
315+ we only use it as
316+
317+ .. code-block :: python
318+
319+ http.request(uri, method = method_name, body = body, headers = headers)
320+
321+ For an example of such an implementation,
322+ a ``gcloud-python `` user created a `custom HTTP class `_
323+ using the `requests `_ library.
324+
325+ .. _custom HTTP class : https://github.com/GoogleCloudPlatform/gcloud-python/issues/908#issuecomment-110811556
326+ .. _requests : http://www.python-requests.org/en/latest/
327+
328+ As for handling authentication on your own,
329+ it may be easiest just to re-use bits from ``oauth2client ``.
330+ Unfortunately, these parts have a hard dependency on ``httplib2 ``.
331+ We hope to enable using `custom HTTP libraries `_ with ``oauth2client `` at
332+ some point.
333+
334+ .. _custom HTTP libraries : https://github.com/google/oauth2client/issues/128
0 commit comments