Skip to content

Conversation

@theacodes
Copy link
Contributor

I weep, but this will help google-cloud-python and google-api-python-client as well as first-party users in google3 migrate off oauth2client without having to change transports.

@dhermes
Copy link
Contributor

dhermes commented Oct 19, 2016

@jonparrott As discussed in chat, move to google_auth_httplib2 directory and make it a standalone package (separate from the main one) on PyPI?

# See the License for the specific language governing permissions and
# limitations under the License.

"""Transport adapter for urllib3."""

This comment was marked as spam.

This comment was marked as spam.


_LOGGER = logging.getLogger(__name__)
# Properties present in file-like streams / buffers.
_STREAM_PROPERTIES = ('read', 'seek', 'tell')

This comment was marked as spam.

This comment was marked as spam.

self._data = data

@property
def status(self):

This comment was marked as spam.

This comment was marked as spam.


@property
def headers(self):
return self._response

This comment was marked as spam.

This comment was marked as spam.

response from the server. This is ignored by httplib2 and will
issue a warning.
kwargs: Additional arguments passed throught to the underlying
httplib2 :meth:`request` method.

This comment was marked as spam.

This comment was marked as spam.

if timeout is not None:
_LOGGER.warning(
'httplib2 transport does not support per-request timeout. '
'Set the timeout when constructing the httplib2.Http instance.'

This comment was marked as spam.

This comment was marked as spam.

raise exceptions.TransportError(exc)


def _make_default_http():

This comment was marked as spam.

This comment was marked as spam.

'https://www.googleapis.com/storage/v1/b')

This class implements :meth:`request` in the same way as
:class:`httplib2.Http` and can be usually be used just like any other

This comment was marked as spam.

This comment was marked as spam.

http (httplib2.Http): The underlying HTTP object to
use to make requests. If not specified, a
:class:`httplib2.Http` instance will be constructed with
sane defaults.

This comment was marked as spam.

This comment was marked as spam.

The underlying :meth:`request` implementation handles adding the
credentials' headers to the request and refreshing credentials as needed.

Args:

This comment was marked as spam.

This comment was marked as spam.

Copy link
Contributor Author

@theacodes theacodes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's been moved to a separate package, @dhermes.

# See the License for the specific language governing permissions and
# limitations under the License.

"""Transport adapter for urllib3."""

This comment was marked as spam.


_LOGGER = logging.getLogger(__name__)
# Properties present in file-like streams / buffers.
_STREAM_PROPERTIES = ('read', 'seek', 'tell')

This comment was marked as spam.

self._data = data

@property
def status(self):

This comment was marked as spam.


@property
def headers(self):
return self._response

This comment was marked as spam.

response from the server. This is ignored by httplib2 and will
issue a warning.
kwargs: Additional arguments passed throught to the underlying
httplib2 :meth:`request` method.

This comment was marked as spam.

if timeout is not None:
_LOGGER.warning(
'httplib2 transport does not support per-request timeout. '
'Set the timeout when constructing the httplib2.Http instance.'

This comment was marked as spam.

raise exceptions.TransportError(exc)


def _make_default_http():

This comment was marked as spam.

'https://www.googleapis.com/storage/v1/b')

This class implements :meth:`request` in the same way as
:class:`httplib2.Http` and can be usually be used just like any other

This comment was marked as spam.

http (httplib2.Http): The underlying HTTP object to
use to make requests. If not specified, a
:class:`httplib2.Http` instance will be constructed with
sane defaults.

This comment was marked as spam.

The underlying :meth:`request` implementation handles adding the
credentials' headers to the request and refreshing credentials as needed.

Args:

This comment was marked as spam.

Copy link
Contributor

@dhermes dhermes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM?


[report]
omit =
*/samples/*

This comment was marked as spam.

This comment was marked as spam.


.. note:: Httplib2 has lots of problems. Using it is highly discouraged. This
library is intended to help existing users of oauth2client migrate to
google-auth.

This comment was marked as spam.

This comment was marked as spam.

library is intended to help existing users of oauth2client migrate to
google-auth.

.. |pypi| image:: https://img.shields.io/pypi/v//google-auth.svg

This comment was marked as spam.

This comment was marked as spam.

@@ -0,0 +1,165 @@
[MASTER]

This comment was marked as spam.

This comment was marked as spam.

@@ -0,0 +1,57 @@
# Copyright 2014 Google Inc.

This comment was marked as spam.

This comment was marked as spam.

description='Google Authentication Library',
long_description=long_description,
url='https://github.com/GoogleCloudPlatform/google-auth-library-python',
modules=['google_auth_httplib2'],

This comment was marked as spam.

This comment was marked as spam.

'pyasn1-modules>=0.0.5',
'rsa>=3.1.4',
'six>=1.9.0',
)

This comment was marked as spam.

This comment was marked as spam.

@@ -0,0 +1,92 @@
# Copyright 2016 Google Inc.

This comment was marked as spam.

This comment was marked as spam.

--import-order-style=google \
--application-import-names="google_auth_httplib2,tests" \
google_auth_httplib2.py tests
pylint --rcfile pylintrc google_auth_httplib2.py

This comment was marked as spam.

This comment was marked as spam.

pytest-cov
pytest-localserver
httplib2
{toxinidir}/..

This comment was marked as spam.

This comment was marked as spam.

@theacodes theacodes merged commit 90db9f2 into master Oct 21, 2016
@theacodes theacodes deleted the httplib2-transport branch October 21, 2016 22:05
@theacodes theacodes restored the httplib2-transport branch October 21, 2016 22:05
@theacodes theacodes deleted the httplib2-transport branch October 21, 2016 22:05
@theacodes theacodes mentioned this pull request Oct 21, 2016
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants