MCPcopy Create free account
hub / github.com/ImSingee/PayJS / request

Method request

payjs/base.py:54–69  ·  view source on GitHub ↗

处理请求(请求时会过滤值为空的参数) :param url: 请求的 url :param data: 请求的参数字典(不包含签名) :return: 返回一个 PayJSResultSuccess 或 PayJSResultFail 类元素

(self, url: str, data: dict, method='POST')

Source from the content-addressed store, hash-verified

52 self.notify_url = notify_url
53
54 def request(self, url: str, data: dict, method='POST'):
55 """
56 处理请求(请求时会过滤值为空的参数)
57
58 :param url: 请求的 url
59 :param data: 请求的参数字典(不包含签名)
60 :return: 返回一个 PayJSResultSuccess 或 PayJSResultFail 类元素
61 """
62 data['sign'] = get_signature(self.key, data)
63 data = {k: v for k, v in data.items() if v}
64 if method == 'GET':
65 r = requests.get(url, params=data, allow_redirects=False)
66 else:
67 r = requests.post(url, data=data, allow_redirects=False)
68
69 return self.parse_response(r)
70
71 def parse_response(self, raw_response: requests.Response):
72 """

Callers 7

nativeMethod · 0.95
cashierMethod · 0.95
jsapiMethod · 0.95
micropayMethod · 0.95
closeMethod · 0.95
refundMethod · 0.95

Calls 2

parse_responseMethod · 0.95
get_signatureFunction · 0.90

Tested by

no test coverage detected