This commit is contained in:
yumoqing 2024-03-02 11:26:44 +08:00
parent 79c04c340e
commit e7420545b2

View File

@ -10,7 +10,6 @@ class OAuthClient:
self.data = desc.get('data')
self.mapis = desc.get('mapis')
self.mkeys = self.mapis.keys()
self.ac = ArgsConvert('${', '}')
async def __call__(self, mapi, params):
@ -22,16 +21,21 @@ class OAuthClient:
headers = {}
for h in d.get('headers',{}):
headers[h.get('name')] = h.get('value')
mydata = {}
for p in d.get('data', {}):
mydata[p.get('name')] = p.get('value')
myparams = {}
for p in d.get('params', {}):
myparams[p.get('name')] = p.get('value')
url = d.get('url')
_params = self.datalize(myparams, params)
_headers = self.datalize(headers, params)
_data = self.datalize(data, params)
response_type = d.get('response_type', RESPONSE_JSON)
hc = HttpClient()
resp_data = await hc.request(url, method, response_type=response_type,
params=_params,
params=_params,
data=_data,
headers=_headers)
if resp_data is None:
raise Exception(f'request error:{url=}\n{method=}\n{response_type=}\n{_params=}\n{_headers=}')