Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Exceeding API RPS results in an unhandled exception #76

Open
IyadKandalaft opened this issue Sep 1, 2024 · 0 comments
Open

[BUG] Exceeding API RPS results in an unhandled exception #76

IyadKandalaft opened this issue Sep 1, 2024 · 0 comments
Assignees

Comments

@IyadKandalaft
Copy link

Describe the bug
Too many requests per second result in an unhandled exception. The limit of API calls per second is unknown.

To Reproduce
Steps to reproduce the behavior:

  1. Query for DNS records of 10+ domains quickly and you will receive an exception for too many requests. It seems to be a 1 minute window but I'm not sure.

Expected behavior
Exception handling with exponential back-off retry of the API call. Alternatively, simple throttling to remain under the API RPS limit is acceptable.

Screenshots
N/A

Debugging information (please complete the following information):

  • GoDaddyPy Version 2.5.1

Additional context
Not having this as a built in feature requires adding ugly wrappers to the library such as this:

class GoDaddyClient:
wait_time = timedelta(milliseconds=1000) #1 second
def init(self, client):
self.client = client
self.last_call_time = datetime.now()

def _wait_until(self):
    time_since_last_call = datetime.now() - self.last_call_time
    if time_since_last_call < self.wait_time:
        time_to_wait = self.wait_time - time_since_last_call
        logger.debug(f"Waiting for {time_to_wait} seconds to avoid GoDaddy API limit")
        sleep(time_to_wait.total_seconds())
        self.last_call_time = datetime.now()

def get_records(self, domain):
    self._wait_until()
    return self.client.get_records(domain)
@IyadKandalaft IyadKandalaft changed the title [BUG] [BUG] Exceeding API RPS results in an unhandled exception Sep 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants