作者:茗瑜42_330 | 来源:互联网 | 2023-09-25 17:44
1234s = requests.Session()r = s.post('http://x.x.x.x/cgi/login.cgi', data={'name': 'ADMIN', 'pwd':
1 2 3 4
| s = requests.Session()
r = s.post('http://x.x.x.x/cgi/login.cgi', data={'name': 'ADMIN', 'pwd': 'ADMIN'},verify=False)
r = s.get(url, COOKIEs=s.COOKIEs,stream=True)
print(r.text) |
IP是内网IP。使用IE,火狐什么的浏览器访问文件都是能下载的。就是用requests访问报错500,真心不知道为什么,求解!
下面是代码:
1 2 3 4 5 6 7 8 9 10 11 12 13
| import requests
import ssl
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
ssl._create_default_https_cOntext= ssl._create_unverified_context
s = requests.Session()
requests.packages.urllib3.disable_warnings()
r=s.post('https://172.30.1.141/cgi/login.cgi', data={'name': 'ADMIN', 'pwd': 'ADMIN'},verify=False)
print(r.text)
url='https://172.30.1.141/cgi/url_redirect.cgi?url_name=ikvm&url_type=jwsk'
rr=s.get(url).content
print(rr) |
下面是浏览器发送得到的信息:
1 2 3 4 5 6 7 8 9 10
| GET /cgi/url_redirect.cgi?url_name=ikvm&url_type=jwsk HTTP/1.1
Accept: text/html, application/xhtml+xml, */*
X-HttpWatch-RID: 23897-11061
Referer: http://172.30.1.141/cgi/url_redirect.cgi?url_name=man_ikvm
Accept-Language: zh-CN
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
Accept-Encoding: gzip, deflate
Host: 172.30.1.78
Connection: Keep-Alive
COOKIE: langSetFlag=0; language=English; SID=ntnfkcvpmqfhmfnt; mainpage=remote; subpage=man_ikvm |
下面是网页返回的信息:
1 2 3 4 5
| HTTP/1.1 200 OK
Content-Length: 2016
Content-Disposition: inline; filename=launch.jnlp
Content-Type: application/x-java-jnlp-file
Date: Wed, 10 May 2017 21:01:00 GMT |