爬取ip地址信息

通过requests携带登录信息,爬取ip地址

import json,requests

login_session = requests.Session()
headers = { 'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36'}

def login():
    url = 'http://11.59.16.211:8080/login/login'
    
    data = {'username':'lhsh','userpass':'57f1af7cf875fa82eb81681bda56712a','pass_token':'1c4ee1439a892188ca9309d112c36c4f'}
    login_session.post(url=url, data=data,json=True,headers=headers)

def home():
    url2 = 'http://11.59.16.211:8080/security/index/list?gid=0&limit=200'
    response = login_session.get(url2,headers = headers)
    r = response.content.decode('unicode_escape')
    finall = json.loads(s = r)



if __name__ == "__main__":
    login()
    home()

你可能感兴趣的:(爬取ip地址信息)