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

Question: What's timeout? #3066

Closed
yjqiang opened this issue Jun 10, 2018 · 8 comments
Closed

Question: What's timeout? #3066

yjqiang opened this issue Jun 10, 2018 · 8 comments
Labels

Comments

@yjqiang
Copy link

yjqiang commented Jun 10, 2018

" class aiohttp.ClientSession(*, connector=None, loop=None, cookies=None, headers=None, skip_auto_headers=None, auth=None, json_serialize=json.dumps, version=aiohttp.HttpVersion11, cookie_jar=None, read_timeout=None, conn_timeout=None, timeout=sentinel, raise_for_status=False, connector_owner=True, auto_decompress=True, proxies=None)

timeout – a ClientTimeout settings structure, 5min
total timeout by default. "
This is from https://docs.aiohttp.org/en/stable/client_reference.html. But I don't understand if it means that the timeout for each get/post request or the timeout for the connection pool. And if it is for the connection pool, how can I set the timeout for each request? Like, http://docs.python-requests.org/en/master/user/quickstart/#timeouts.

@asvetlov
Copy link
Member

@yjqiang
Copy link
Author

yjqiang commented Jun 11, 2018

Sorry, maybe it is because my English is not good enough, but I'm still not sure about that.

@asvetlov
Copy link
Member

Try to read the chapter from the link above and ask a concrete question.

@yjqiang
Copy link
Author

yjqiang commented Jun 12, 2018

For example, I use one clientsession to make several requests. And because the programme will run for hours, I won't close the session. I want to set the timeout for each request, so that if I don't get the response in 3s, I will try this again. So how can I make it?

@asvetlov
Copy link
Member

async with session.get(url, timeout=...)

@yjqiang
Copy link
Author

yjqiang commented Jun 12, 2018

Although I have differents requests, but I want to set the same timeout for each request. So can I write like aiohttp.ClientSession(timeout=3)?

@asvetlov
Copy link
Member

Yes, you can.

I think we can close the issue.

@lock
Copy link

lock bot commented Oct 28, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a [new issue] for related bugs.
If you feel like there's important points made in this discussion, please include those exceprts into that [new issue].
[new issue]: https://github.com/aio-libs/aiohttp/issues/new

@lock lock bot added the outdated label Oct 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants