55from vrcpy .errors import *
66
77class ACall :
8- def __init__ (self , loop = asyncio .get_event_loop ()):
8+ def __init__ (self , loop = asyncio .get_event_loop (), verify = True ):
9+ self .verify = verify
910 self .loop = loop
1011 self .session = None
1112 self .apiKey = None
@@ -31,7 +32,7 @@ async def call(self, path, method="GET", headers={}, params={}, json={}, no_auth
3132 return await self ._call (path , method , headers , params , json )
3233
3334 if self .apiKey == None :
34- async with self .session .get ("https://api.vrchat.cloud/api/1/config" ) as resp :
35+ async with self .session .get ("https://api.vrchat.cloud/api/1/config" , verify_ssl = self . verify ) as resp :
3536 assert resp .status == 200
3637 j = await resp .json ()
3738
@@ -46,7 +47,7 @@ async def call(self, path, method="GET", headers={}, params={}, json={}, no_auth
4647 if type (params [param ]) == bool : params [param ] = str (params [param ]).lower ()
4748
4849 params ["apiKey" ] = self .apiKey
49- async with self .session .request (method , path , params = params , headers = headers , json = json ) as resp :
50+ async with self .session .request (method , path , params = params , headers = headers , json = json , verify_ssl = self . verify ) as resp :
5051 if resp .status != 200 :
5152 content = await resp .content .read ()
5253
@@ -69,7 +70,7 @@ async def _call(self, path, method="GET", headers={}, params={}, json={}):
6970
7071 async with aiohttp .ClientSession (headers = h ) as session :
7172 if self .apiKey == None :
72- async with session .get ("https://api.vrchat.cloud/api/1/config" ) as resp :
73+ async with session .get ("https://api.vrchat.cloud/api/1/config" , verify_ssl = self . verify ) as resp :
7374 assert resp .status == 200
7475 j = await resp .json ()
7576
@@ -84,7 +85,7 @@ async def _call(self, path, method="GET", headers={}, params={}, json={}):
8485 if type (params [param ]) == bool : params [param ] = str (params [param ]).lower ()
8586
8687 params ["apiKey" ] = self .apiKey
87- async with session .request (method , path , params = params , headers = headers , json = json ) as resp :
88+ async with session .request (method , path , params = params , headers = headers , json = json , verify_ssl = self . verify ) as resp :
8889 if resp .status != 200 :
8990 content = await resp .content .read ()
9091
@@ -99,7 +100,8 @@ async def _call(self, path, method="GET", headers={}, params={}, json={}):
99100 return {"status" : status , "data" : json }
100101
101102class Call :
102- def __init__ (self ):
103+ def __init__ (self , verify = True ):
104+ self .verify = verify
103105 self .apiKey = None
104106 self .b64_auth = None
105107
@@ -123,7 +125,7 @@ def call(self, path, method="GET", headers={}, params={}, json={}, no_auth=False
123125 headers ["Authorization" ] = "Basic " + self .b64_auth
124126
125127 if self .apiKey == None :
126- resp = self .session .get ("https://api.vrchat.cloud/api/1/config" )
128+ resp = self .session .get ("https://api.vrchat.cloud/api/1/config" , verify = self . verify )
127129 assert resp .status_code == 200
128130
129131 j = resp .json ()
@@ -138,7 +140,7 @@ def call(self, path, method="GET", headers={}, params={}, json={}, no_auth=False
138140 if type (params [param ]) == bool : params [param ] = str (params [param ]).lower ()
139141
140142 params ["apiKey" ] = self .apiKey
141- resp = self .session .request (method , path , headers = headers , params = params , json = json )
143+ resp = self .session .request (method , path , headers = headers , params = params , json = json , verify = self . verify )
142144
143145 if resp .status_code != 200 :
144146 try : json = resp .json ()
@@ -150,7 +152,7 @@ def call(self, path, method="GET", headers={}, params={}, json={}, no_auth=False
150152
151153 def _call (self , path , method = "GET" , headers = {}, params = {}, json = {}):
152154 if self .apiKey == None :
153- resp = requests .get ("https://api.vrchat.cloud/api/1/config" , headers = headers )
155+ resp = requests .get ("https://api.vrchat.cloud/api/1/config" , headers = headers , verify = self . verify )
154156 assert resp .status_code == 200
155157
156158 j = resp .json ()
@@ -165,7 +167,7 @@ def _call(self, path, method="GET", headers={}, params={}, json={}):
165167 if type (params [param ]) == bool : params [param ] = str (params [param ]).lower ()
166168
167169 params ["apiKey" ] = self .apiKey
168- resp = requests .request (method , path , headers = headers , params = params , data = json )
170+ resp = requests .request (method , path , headers = headers , params = params , data = json , verify = self . verify )
169171
170172 if resp .status_code != 200 :
171173 try : json = resp .json ()
0 commit comments