Skip to content
This repository was archived by the owner on Jun 11, 2025. It is now read-only.

Commit 724cefd

Browse files
committed
Add separate rate limit exception
Fixes #267.
1 parent 4adfb80 commit 724cefd

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

skpy/conn.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import requests
1313
from bs4 import BeautifulSoup
1414

15-
from .core import SkypeApiException, SkypeAuthException, SkypeEnum, SkypeObj
15+
from .core import SkypeApiException, SkypeAuthException, SkypeEnum, SkypeObj, SkypeRateLimitException
1616

1717

1818
class SkypeConnection(SkypeObj):
@@ -245,7 +245,7 @@ def __call__(self, method, url, codes=(200, 201, 202, 204, 207), auth=None, head
245245
print(resp.text)
246246
if resp.status_code not in codes:
247247
if resp.status_code == 429:
248-
raise SkypeAuthException("Auth rate limit exceeded", resp)
248+
raise SkypeRateLimitException("Rate limit exceeded", resp)
249249
raise SkypeApiException("{0} response from {1} {2}".format(resp.status_code, method, url), resp)
250250
return resp
251251

skpy/core.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,16 @@ class SkypeApiException(SkypeException):
231231
"""
232232

233233

234+
class SkypeRateLimitException(SkypeApiException):
235+
"""
236+
An exception thrown if a limit has been reached.
237+
238+
Arguments will be of the form (``message``, ``response``).
239+
240+
This may be a cooldown on authentication, message sending, or another action performed too frequently.
241+
"""
242+
243+
234244
class SkypeAuthException(SkypeException):
235245
"""
236246
An exception thrown when authentication cannot be completed.

0 commit comments

Comments
 (0)