Skip to content

Commit cb070f0

Browse files
authored
Make 2fa required error readable (#2)
1 parent b9c5ba5 commit cb070f0

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

generate.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,7 @@ sed -i 's/abcdefvrc//g' ./setup.py
3838
sed -i '/license/a long_description_content_type="text/markdown",' ./setup.py
3939

4040
# Remove messily pasted markdown at top of every file
41-
find vrchatapi -type f -exec sed -i '/VRChat API Banner/d' {} \;
41+
find vrchatapi -type f -exec sed -i '/VRChat API Banner/d' {} \;
42+
43+
# Make 2fa required error readable
44+
patch ./vrchatapi/rest.py < ./patches/error_2fa_verify_readable.patch
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
diff --git a/vrchatapi/rest.py b/vrchatapi/rest.py
2+
index aac58f3..703ae1b 100644
3+
--- a/vrchatapi/rest.py
4+
+++ b/vrchatapi/rest.py
5+
@@ -239,6 +239,10 @@ class RESTClientObject(object):
6+
7+
raise ApiException(http_resp=r)
8+
9+
+ if re.match(b'{"\w{21}":\["totp","otp"]}', r.data) is not None:
10+
+ r.reason = "2 Factor Authentication verification is required"
11+
+ raise UnauthorizedException(http_resp=r)
12+
+
13+
return r
14+
15+
def GET(self, url, headers=None, query_params=None, _preload_content=True,

vrchatapi/rest.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,10 @@ def request(self, method, url, query_params=None, headers=None,
239239

240240
raise ApiException(http_resp=r)
241241

242+
if re.match(b'{"\w{21}":\["totp","otp"]}', r.data) is not None:
243+
r.reason = "2 Factor Authentication verification is required"
244+
raise UnauthorizedException(http_resp=r)
245+
242246
return r
243247

244248
def GET(self, url, headers=None, query_params=None, _preload_content=True,

0 commit comments

Comments
 (0)