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

light version of HttpClient #199

Closed
fafhrd91 opened this issue Dec 12, 2014 · 5 comments
Closed

light version of HttpClient #199

fafhrd91 opened this issue Dec 12, 2014 · 5 comments
Labels

Comments

@fafhrd91
Copy link
Member

i removed HttpClient from 0.12, but i think we need some lightweight version of it,
something like

    client = aiohttp.HttpClient('http://...', keep_alive=True)
    yield from client.request('GET', '/path1')
    yield from client.request('POST', '/path2')

@asvetlov @kxepal @popravich ?

@asvetlov
Copy link
Member

I think we need http session object for processing keep-alive and cookies updating.
Something that behaves like-a-browser-page.
IIRC @kxepal had shared the idea.
keep-alive and cookies should be enabled by default (I doubt we need to disable those at all for high-level-client).

Another question: should client/session be constructed on top of connection pool like request library does?
My opinion is NO, we can add connection_pool abstraction on top of session:

with (yield from pool) as conn:
    yield from conn.get()

@fafhrd91
Copy link
Member Author

what is the reason for keep alive and cookies? we already have both in connector. same for connection pool

@kxepal
Copy link
Member

kxepal commented Dec 13, 2014

Hm..personally, I didn't found HttpClient useful: it's quite primitive while for mature setups you'll already have some load balancer like haproxy in front of your nodes making HttpClient pool feature not actual.

May be it's good to have poorman's client with the connection pool. However, then it should be more featured to not just round robin all the hosts until first success, but pick the best according connection time, load, responsibility and other metrics. What I support is a good topic for new project outside aiohttp domain.

As about lightweight http client, I think it should be also more human-friendly: having always to pass request method as a string doesn't make it so.

    client = aiohttp.HttpClient('http://...', keep_alive=True)
    yield from client.get('/path1')
    yield from client.post('/path2')

As about having http session object +1. However, it shouldn't be a hardly embed into the client: http session (cookie, auth headers, whatever) is just a request context which should be switched with easy without creating another HttpClient instance.

@asvetlov
Copy link
Member

Fixed by introducing ClientSession #328

@lock
Copy link

lock bot commented Oct 29, 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.

@lock lock bot added the outdated label Oct 29, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 29, 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

3 participants