Skip to content
This repository was archived by the owner on Dec 20, 2021. It is now read-only.

Commit 82461a9

Browse files
committed
Raise for rate-limiting
1 parent 931fcb0 commit 82461a9

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

vrcpy/errors.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,8 @@ class WebSocketError(Exception):
6161
class WebSocketOpenedError(Exception):
6262
# When 2 websockets are attempted to be open
6363
pass
64+
65+
66+
class RateLimitError(Exception):
67+
# When VRChat is ratelimiting this user
68+
pass

vrcpy/request.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,14 @@ def handle_404():
3939

4040
raise NotFoundError(msg)
4141

42+
def handle_429():
43+
raise RateLimitError("You are being rate-limited.")
44+
4245
switch = {
4346
400: lambda: handle_400(),
4447
401: lambda: handle_401(),
45-
404: lambda: handle_404()
48+
404: lambda: handle_404(),
49+
429: lambda: handle_429()
4650
}
4751

4852
if resp["status"] in switch:

0 commit comments

Comments
 (0)