square-python-sdk icon indicating copy to clipboard operation
square-python-sdk copied to clipboard

Async

Open lacasaprivata2 opened this issue 3 years ago • 3 comments

Hi there!

I was wondering whether or not this library will support async anytime soon

lacasaprivata2 avatar Sep 10 '21 21:09 lacasaprivata2

Hello @thomaspaulgrey! Would you be able to provide any details about your use case for async support? This would help us with prioritizing feature work.

wolfadex avatar Feb 01 '22 15:02 wolfadex

I'm using the Squrae SDK in my backend and async requests makes it very easy to perform other tasks while waiting for the response to a request to Square. If the "other tasks" are also io/network bound (e.g. more requests to Square 😄), I'm likely also running them in an async way, such that I can combine the waiting time (as such, the time I wait is approx. equal to the time the slowest task takes). This is naturally much faster than doing all the waiting sequentially.

And yes, much of that could be done using threads, but there are various disadvantages (especially for i/o bound operations) to using threading over asyncio. See e.g. this great comment.

See also these fastapi docs providing a detailed, yet simple and intuitive motivation for using async requests.

philipk19238 avatar Jan 30 '23 00:01 philipk19238

Hi there, I'm sorry to report that at this time we will not be adding 'async' functionality to the SDK. I will leave this issue open as a data point for when we go to make feature improvements to our SDKs though. For now it will be marked as Won't fix - thank you for raising this question with us!

zenmasterjobo avatar Mar 19 '24 16:03 zenmasterjobo