我绝对是 QtNetwork 模块的新手,这里有一个简单的问题。为什么reply.rawHeaderPairs () ==[] 在这里?有什么不对 ?
import sys
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from PyQt4.QtNetwork import *
if __name__ == '__main__':
app =QCoreApplication(sys.argv)
manager=QNetworkAccessManager ()
url =input('input url :')
print(QUrl.fromEncoded(QUrl(url).toEncoded()))
request=QNetworkRequest (QUrl.fromEncoded(QUrl(url).toEncoded()))
request.setRawHeader("User-Agent" ,'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1')
reply = manager.get(request)
print(reply.rawHeaderPairs () )
sys.exit()