1. Installation Requests;
pip install requests
2. In the HTTP request, the most commonly used there are GET, POST, request through repository can be implemented as interface to the following test method post
#!/usr/bin/env python #coding:utf-8 import requests #传入参数 url = 'http://ip.taobao.com/service/getIpInfo.php' param = [{"ip": "117.89.35.58"}, {"ip": "117.79.35.58"}, {"ip": "117.69.35.58"}] def ta_bao(url,param): result=requests.post(url,param) printcall the post method requests of# (result.json ()) # print return results for Item in param: # cycle parameters inserted for ta_bao (URL, Item)
The following will print out the interface returns the result