web-push-libs / pywebpush

Python Webpush Data encryption library
Mozilla Public License 2.0
303 stars 52 forks source link

Async Send Function #150

Open tmose1106 opened 1 year ago

tmose1106 commented 1 year ago

I'm kinda surprised there's not more issues regarding async besides #142

Is adding an async send_async function something you would be interested in adding to the library?

I haven't worked out an implementation yet, but I'm open to doing so if there's interest in merging. Although, it would likely involve removing the requests dependency and replacing it with httpx which implements the requests interface but also provides an async client.

jrconlin commented 1 year ago

Not really? I mostly consider this library to be just an assist sort of thing. Anything that wanted to do heavier lifting would just call the functions in WebPusher directly. You could call Webpusher.encode() directly without going though the send bits, or fabricate your own send using that function as an example.

I can see possibly extracting the header fixup stuff from send into their own function, but those tend to be a bit specific for the push transaction.