GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — DISCUSSION: Allow http as an argument to Connection so libraries other than httplib2 can be used · Issue #551 · googleapis/google-cloud-python

DISCUSSION: Allow http as an argument to Connection so libraries other than httplib2 can be used #551

New issue
Copy link
New issue
Copy link
Closed
#608
Closed
DISCUSSION: Allow http as an argument to Connection so libraries other than httplib2 can be used#551
#608
Copy link
Assignees
dhermes
Labels
api: coretype: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.type: questionRequest for information or clarification. Not an issue.

Description

@dhermes
dhermes
opened on Jan 15, 2015
Issue body actions

This way we can support people using Twisted (for example) or other frameworks without having to write any other code. Though docs could be nice? We could supply an abstract class for them to subclass?


As of 12ac983:

$ git log -1 --pretty=%H
12ac983fe613785c998aeeb1d8b981f4b5b347d9
$ git grep '\.http' -- gcloud/ | egrep -v 'test'
gcloud/datastore/connection.py:        :raises: :class:`six.moves.http_client.HTTPException` if the response
gcloud/datastore/connection.py:        headers, content = self.http.request(
gcloud/datastore/connection.py:            raise six.moves.http_client.HTTPException(message)
gcloud/storage/connection.py:        return self.http.request(uri=url, method=method, headers=headers,
gcloud/storage/key.py:        download.InitializeDownload(request, self.connection.http)
gcloud/storage/key.py:        upload.InitializeUpload(request, conn.http)
gcloud/storage/key.py:            http_wrapper.MakeRequest(conn.http, request, retries=num_retries)

We only actively use the httplib2.Http() instance twice. Once in storage.connection.Connection.make_request:

        return self.http.request(uri=url, method=method, headers=headers,
                                 body=data)

and once in datastore.connection.Connection._request:

        headers, content = self.http.request(
            uri=self.build_api_url(dataset_id=dataset_id, method=method),
            method='POST', headers=headers, body=data)

In either case the object only needs to be able to accept

  • uri
  • method
  • headers
  • body

and needs to append a

Authorization: Bearer ya29.some-OAUTH-TOKEN...

header to headers. (See the source, the user agent is also updated and the request is retried if a 401 Unauthorized is encountered, but an external client need not do either of those.)


ASIDE: Should we add an auth label?

Activity

Next
  1. dhermes
    added
    type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.
    type: questionRequest for information or clarification. Not an issue.
    on Jan 15, 2015
  2. dhermes commented on Jan 15, 2015

    @dhermes
    dhermes
    on Jan 15, 2015
    ContributorAuthor
    More actions

    Other things to note:

    1. As seen above, the httplib2.Http() instance is passed along to our vendored in apitools code.
    2. The credentials object is used in storage.Connection.generate_signed_url (and nowhere else):
    $ git grep -n '\.credentials' | egrep -v 'test'
    gcloud/storage/connection.py:550:        query_params = _get_signed_query_params(self.credentials,
    
  3. jgeewax
    modified the milestone: This milestone has been deleted on Jan 30, 2015
  4. jgeewax
    added
    api: core
    on Jan 30, 2015
  5. dhermes
    modified the milestones: This milestone has been deleted, This milestone has been deleted on Feb 9, 2015
  6. dhermes
    added 3 commits that reference this issue on Feb 10, 2015

    Allow http as an argument to base Connection class.

    This issue will close once commit 57bbd2a is merged into the 'master' branch.
    57bbd2a

    Allow http as an argument to base Connection class.

    This issue will close once commit aaf8976 is merged into the 'master' branch.
    aaf8976

    Allow http as an argument to base Connection class.

    This issue will close once commit 6dd2caf is merged into the 'master' branch.
    6dd2caf
  7. dhermes
    closed this as completedin #608on Feb 12, 2015
  8. JustinBeckwith
    assigned
    dhermes
    on Feb 1, 2021
  9. 4 remaining items

  10. parthea
    added a commit that references this issue on Aug 21, 2025

    chore(deps): update dependency google-cloud-bigquery to v3.4.2 (#551)

    1d3dd3c
  11. parthea
    added 2 commits that reference this issue on Sep 16, 2025

    chore(deps): update dependency google-cloud-bigquery to v3.4.2 (#551)

    e15adf5

    chore(main): release 0.17.8 (#551)

    485822c
  12. parthea
    added 6 commits that reference this issue on Nov 22, 2025

    chore(python): refactor unit / system test dependency install (#551)

    507aa1d

    chore: distinguish default/mtls endpoint for tests (#551)

    24576ba

    chore(main): release 2.14.0 (#551)

    479c025

    chore(python): conditionally load credentials in .kokoro/build.sh (#551)

    1d8f9fb

    feat: Add support for library instrumentation (#551)

    59c7839

    feat: Add support for library instrumentation (#551)

    92cd501
  13. parthea
    added 6 commits that reference this issue on Mar 2, 2026

    process: add mypy session for samples (#551)

    54c3d9b

    fix: remove DB-API dependency on pyarrow with decimal query parameters (

    7beceec

    chore: release 2.12.0 (#547)

    10a16cb

    chore(deps): update dependency opentelemetry-api to v1.29.0 (#551)

    027aaf5

    tests: harden 'test_bucket_w_retention_period' vs EC (#552)

    5015c49

    chore(deps): update dependency google-cloud-testutils to v1.1.0 (#551)

    4c64f81
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @dhermes
    dhermes

Labels

api: coretype: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.type: questionRequest for information or clarification. Not an issue.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.