boy-hack / hack-requests

The hack-requests is an http network library for hackers
MIT License
466 stars 90 forks source link

BZ帮忙看看,出了点问题 #3

Closed zstreamer closed 5 years ago

zstreamer commented 5 years ago

测试代码 import HackRequests as hack

url = "http://x.hacking8.com" hh = hack.http(url,timeout=20)
print(hh.text()) print('a') 报错信息 Traceback (most recent call last): File "C:\Users\Administrator\Desktop\python\ukestudy\test.py", line 1, in import HackRequests as hack ImportError: No module named HackRequests

zstreamer commented 5 years ago

搞定了 import HackRequests hack = HackRequests.hackRequests() url = "http://baidu.cn/" u = hack.http(url) print(u.url,u.status_code,'\n',u.cookie) print(u.log.get("request")) print() print(u.log.get("response")) print(u.text()) 返回 http://baidu.cn/ 200

GET / HTTP/1.1

Host: baidu.cn

Accept-Encoding: gzip, deflate

Connection: close

User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.71 Safari/537.36

HTTP/1.1 200 OK

Date: Thu, 10 Jan 2019 05:35:07 GMT Server: Apache Last-Modified: Tue, 12 Jan 2010 13:48:00 GMT ETag: "51-47cf7e6ee8400" Accept-Ranges: bytes Content-Length: 81 Cache-Control: max-age=86400 Expires: Fri, 11 Jan 2019 05:35:07 GMT Connection: Close Content-Type: text/html

[Finished in 0.5s]