allisson / python-simple-rest-client

Simple REST client for python 3.8+
MIT License
164 stars 48 forks source link

suggestion regarding async #55

Open dearkafka opened 1 year ago

dearkafka commented 1 year ago

Hi! I've been using simple-rest-client for https://github.com/dearkafka/woot and I liked the logic so far, but I just hacked it a little bit for better __repr__ and stuff. But I was thinking that maybe how async is currently made is not the best way? the thing is right now async client will be closed every time and that means that user need to re-init presumable the whole class of api with resource, right? that does not sound so great, also sync logic allows to be re-used easily. I hacked this too in my repo but thats not so elegant since I wanted to avoid redefining your own code (https://github.com/dearkafka/woot/blob/aebb9d5051fe73101e0ab01ac335d12aa044160d/woot/resources.py#L137)

what do you think about this issue?

dearkafka commented 1 year ago

so, to be precise, I dont have a PR or solution right away as Im not sure myself how to tackle it best. But I noticed that I cant even use different actions inside 1 resource, so I made a client for every action call. that presumably also not so great.

allisson commented 1 year ago

@dearkafka Hello, I think this problem was fixed in version 1.2.0, now async can be re-used (https://github.com/allisson/python-simple-rest-client/issues/56).

dearkafka commented 1 year ago

yes, I believe it is