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

Commit 719cd85

Browse files
committed
Make call_retries actually able to be changed
1 parent 4a7c70f commit 719cd85

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

vrcpy/request.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
from vrcpy.errors import *
77

88

9-
call_retries = 1
10-
11-
129
def raise_for_status(resp):
1310
if type(resp["data"]) == bytes:
1411
resp["data"] = json.loads(resp["data"].decode())
@@ -61,6 +58,8 @@ def handle_429():
6158

6259

6360
class ACall:
61+
call_retries = 1
62+
6463
def __init__(self, loop=None, verify=True):
6564
self.verify = verify
6665
self.loop = loop or asyncio.get_event_loop()
@@ -84,12 +83,12 @@ async def closeSession(self):
8483
self.session = None
8584

8685
async def call(self, path, method="GET", headers={}, params={}, json={}, no_auth=False, verify=True, retries=None):
87-
for tri in range(0, (retries or call_retries) + 1):
86+
for tri in range(0, (retries or self.call_retries) + 1):
8887
try:
8988
resp = await self._call_wrap(path, method, headers, params, json, no_auth, verify)
9089
break
9190
except requests.exceptions.ConnectionError as e: # Gosh darnit VRC team, why've you done this!
92-
if tri == (retries or call_retries):
91+
if tri == (retries or self.call_retries):
9392
raise requests.exceptions.ConnectionError(
9493
str(e) + " ({} retries)".format(retries))
9594

@@ -189,6 +188,8 @@ async def _call(self, path, method="GET", headers={}, params={}, json={}, verify
189188

190189

191190
class Call:
191+
call_retries = 1
192+
192193
def __init__(self, verify=True):
193194
self.verify = verify
194195
self.apiKey = None
@@ -204,12 +205,12 @@ def new_session(self):
204205
self.b64_auth = None
205206

206207
def call(self, path, method="GET", headers={}, params={}, json={}, no_auth=False, verify=True, retries=None):
207-
for tri in range(0, (retries or call_retries) + 1):
208+
for tri in range(0, (retries or self.call_retries) + 1):
208209
try:
209210
resp = self._call_wrap(path, method, headers, params, json, no_auth, verify)
210211
break
211212
except requests.exceptions.ConnectionError as e: # Gosh darnit VRC team, why've you done this!
212-
if tri == (retries or call_retries):
213+
if tri == (retries or self.call_retries):
213214
raise requests.exceptions.ConnectionError(
214215
str(e) + " ({} retries)".format(retries))
215216

0 commit comments

Comments
 (0)