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

pycurl support python asyncio or async(await)? #448

Closed
rfyiamcool opened this issue Jul 20, 2017 · 5 comments
Closed

pycurl support python asyncio or async(await)? #448

rfyiamcool opened this issue Jul 20, 2017 · 5 comments

Comments

@rfyiamcool
Copy link

pycurl support python asyncio or async(await)?

@p
Copy link
Member

p commented Aug 15, 2017

I doubt I will do this but patches are welcome.

@p p closed this as completed Aug 15, 2017
@brizzbane
Copy link

brizzbane commented Jun 14, 2019

I know this is old.

This is the issue that pops up when I google 'pycurl asyncio', so that is why I am asking here.

Would pycurl work alright with just putting everything in async def, if the pycurl event loop was hooked up with asyncio?

A few years ago, before asyncio was even implemented I think, I was messing with a project 'pyuv', and used Tornado's (at the time) example of a http client, to hook up pycurls event loop, with pyuv.

You can see here:

https://raw.githubusercontent.com/brizzbane/uvcurl/master/uvcurl/httpclient.py

I'm thinking about trying to hook it up with an asyncio event loop (mainly self._multi.setopt(pycurl.M_SOCKETFUNCTION, self._sock_state_cb), if I am remembering correctly).. Should this just work?

I'm still pretty newb to using the native python 3 async stuff. If someone knows right off the bat that I would have issues for some reason, it would save me some time...

I want to use pycurl as opposed to requests for this particular project I'm working on, because it uses non-http requests.

@p
Copy link
Member

p commented Jun 17, 2019

If you get it working, please share your findings.

@fsbs
Copy link
Contributor

fsbs commented Oct 28, 2021

@rfyiamcool @brizzbane @p

Take a look at aiocurl:

handle = aiocurl.Curl()
handle.setopt(aiocurl.URL, 'https://example.com')

await handle.perform()

You can install it with pip install aiocurl.

It uses libcurl's socket interface to make asyncio's event loop drive the transfers.

@p
Copy link
Member

p commented Jan 15, 2022

@fsbs That's cool, if you'd like to add a link to pycurl readme/documentation to your project please send a PR.

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

No branches or pull requests

4 participants