Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How should we pass options for http clients in service client creation? #3109

Closed
daspecster opened this issue Mar 6, 2017 · 8 comments
Closed
Assignees

Comments

@daspecster
Copy link
Contributor

In order to address #2988, where timeouts are not a service option, but need to be handled by the HTTP client.

How should we handle passing arguments like timeout when creating a service client?

client = someservice.Client(timeout=10)

This value could then be passed here but we would need to assume the argument was available.

In this case google_auth_httplib2.AuthorizedHttp doesn't take the argument but rather an already created http client.

We could make another mixin class for Client I suppose that supports setting timeout?

@lukesneeringer
Copy link
Contributor

This question should likely be informed by #1998, since how that implementation is done may affect this.

I would also be okay with only supporting a situation like a custom timeout if they use our default objects.

@dhermes
Copy link
Contributor

dhermes commented Mar 6, 2017

I am 👍 on the idea to make it configurable, but I really wish we had an easier way of passing in custom transport objects. For example

import urllib3
pool_manager = urllib3.PoolManager(timeout=10)

@theacodes
Copy link
Contributor

This is probably an artifact of httplib2, all other transports can accept a timeout per-request.

@daspecster
Copy link
Contributor Author

So is this something that should wait, and maybe focus on #1998 first?

@lukesneeringer
Copy link
Contributor

Defer to @dhermes, but that is my take on it.

@theacodes
Copy link
Contributor

So many things will be easier once we nail #1998.

@lukesneeringer
Copy link
Contributor

Closing for now. #1998 is in progress.

@glarrain
Copy link

Hi @lukesneeringer. I wonder if you could explain how #1998 solves the problems raised in this issue.

From what I've been able to dig up, there is no way to set up a timeout/retries for a client in a simple and clean way (i.e. not involving private APIs nor deprecated parameters). The closest would be the timeout decorators (defined in google.api_core.timeout) but those are only of some use if the caller has access to the function with an arg named timeout but in that case they are barely helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants