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

Rate Limit on findSubscribers method #31

@AlJohri

Description

@AlJohri

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions