马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本来想写一个工具来用,查询ip的,但是写到一般发现响应值是乱码,试了很多解码都不行,求助啊~~
搞不懂这个上传图片是咋回事,我就把乱码放这了:� ��n�������IHo3Lb����v��ۦy�I���gs��h��Io
K��jo�y�M'�0=LB+�d����ΪM���zl���דIޠF)�>��"�����C���B��2�d�
代码如下import requests
import re
def bl():
ip = input('请输入需要查询的ip:')
url = 'https://tool.lu/ip/ajax.html'
hd = {
'authority': 'tool.lu',
'method': 'POST',
'path': '/ip/ajax.html',
'scheme': 'https',
'accept': 'application/json, text/javascript, */*; q=0.01',
'accept-encoding': 'gzip, deflate, br',
'accept-language': 'zh-CN,zh;q=0.9',
'content-length': '16',
'content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
'cookie': 'slim_session=%7B%22slim.flash%22%3A%5B%5D%7D; Hm_lvt_0fba23df1ee7ec49af558fb29456f532=1594350650; Hm_lpvt_0fba23df1ee7ec49af558fb29456f532=1594350650; uuid=44249d0f-d602-4d7f-cd92-61b82a537d04; _access=a5c9592fef166770555234892c9df3f64086907a3d24b1c3ed53a267ad0dff9f',
'origin': 'https://tool.lu',
'referer': 'https://tool.lu/ip/',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'same-origin',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.87 Safari/537.36 SLBrowser/6.0.1.6181',
'x-requested-with': 'XMLHttpRequest',
}
data = {
'ip': ip,
}
response = requests.post(url,headers=hd,data=data)
print(response.text)
bl()
|