A, urllib module: python own module
1, get urllib module requests:
from the urllib Import the urlopen # open URL from The urllib.parse Import urlencode # GET request: URL = ' https://api.nnzhp.cn/api/user/stu_info ' D = { ' stu_name ' : ' white ' } REQ = the urlopen (URL + ' ? ' + urlencode (D)) # GET request parameters to be converted into binary Print (req.read ()) # result returns bytes type Print (req.read (). decode ()) # returns the results translated into strings
2, post urllib module requests: