Open ioistired opened 3 years ago
So if I understand correctly, this is the kind of API you'd like?
pack = Pack()
client = StickersClient("foo", "bar")
# So instead of
client.upload_pack(pack)
# You would do something like
try:
registration = client.register(pack)
client.upload_pack_from_registration(pack, registration)
except RateLimitException:
...
In addition to, yea. client.upload_pack(pack)
would be equivalent to client.upload_pack_from_registration(pack, client.register(pack))
. What do you think?
Yeah I meant in addition, sorry! I've looked into Signal server code, and it does not seems that a method to get the rate limit status is available.
I can see the point of this use-case, so I'll try to do in the next days!
In Adhesive, I'd like to check if I've been rate limited before proceeding with the conversion process. I propose to separate the pack registration code:
https://github.com/signalstickers/signalstickers-client/blob/2d74c4558ca0b91d7b25e2c5fb05288928c197fb/signalstickers_client/classes/uploader.py#L24-L39
Into a separate public function that returns pack_attrs and pack_key. The caller doesn't care about this data, and treats it as an opaque "token" object to be passed back to the upload code. For backwards compatibility and to maintain a simple API, upload_pack should remain as is with the same interface, wrapping the new function.