Stranger6667/postmarker

Offset / count invariant when you have more than 10,000 messages

silviogutierrez opened this issue · 0 comments

Hi there,

Thanks for a great library. I'm running into an edge case. If you have more than 10,000 outbound messages, this library will break as the count=None loop will eventually send a request like so:

https://api.postmarkapp.com/messages/outbound?count=500&offset=10000

And per Postmark's docs, the max of count + offset = 10,000.

So you'll get a 500 error from them.

This isn't an issue if the TotalCount in base.py returns less 10,000 because you'll break out of the loop.

I'm not sure how best to handle this. It seems like, no matter what we do, we can't get to message 10,001+ on postmark. So maybe the loop should also just break at 10,000.

Hope that helps. Thanks again for your work!