标签:格式 一个 name ret excel读取 exce post请求 封装 ==
# 封装一个请求类
import requests
class GetRequest:
def get_request(self, method, url, data=None):
# 从excel读取出来的数据转成json格式
if type(data) == str:
data = eval(data)
method = method.upper()
if method == ‘GET‘:
return requests.get(url, params=data)
elif method == ‘POST‘:
return requests.post(url, data)
if __name__==‘__main__‘:
标签:格式 一个 name ret excel读取 exce post请求 封装 ==
原文地址:https://www.cnblogs.com/sophia-985935365/p/12631505.html