Skip to content
This repository has been archived by the owner on Aug 29, 2019. It is now read-only.

Rate Limit on findSubscribers method #31

Open
AlJohri opened this issue Jul 31, 2015 · 0 comments
Open

Rate Limit on findSubscribers method #31

AlJohri opened this issue Jul 31, 2015 · 0 comments

Comments

@AlJohri
Copy link

AlJohri commented Jul 31, 2015

I have a simple loop like so:

for i, subscriber in enumerate(account.findSubscribers()):
    print i, subscriber.id, subscriber.name, subscriber.email

which is constantly rate limited because the library is making requests too quickly.

I'm having to either resort so some ugly monkey patching:

#### MONKEY PATCH
AWeberCollection._original_load_page_for_offset = AWeberCollection._load_page_for_offset
def new_load_page_for_offset(self, offset):
    sleep(0.25)
    AWeberCollection._original_load_page_for_offset(self, offset)
AWeberCollection._load_page_for_offset = new_load_page_for_offset
#### MONKEY PATCH

or adding a delay at perhaps i % 100.

Any better solutions?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant