Packaging a request class #
Import Requests
class GetRequest:
DEF Get_Request (Self, Method, URL, Data = None):
# read out from excel format data into json
IF type (Data) == STR:
Data = the eval (Data )
Method = method.upper ()
IF Method == 'the GET':
return requests.get (URL, the params = Data)
elif Method == 'the POST':
return requests.post (URL, Data)
IF __name__ __ == '__ main__ ':
Package GET / POST request
Guess you like
Origin www.cnblogs.com/sophia-985935365/p/12631505.html
Recommended
Ranking