PDA

View Full Version : pyqt QWebView and .htaccess-protected pages



lykwydchykyn
May 4th, 2011, 09:36 PM
I have a utility I wrote in pyQT that accesses several password-protected pages in a QWebView. The pages use basic .htaccess/apache security, and run on various debian squeeze servers running apache2.

It worked fine for a long time, then at some point it stopped (I only occasionally use this function of the utility, so I'm not sure what proceeded the failure).

I wrote this demo code:



from PyQt4.QtGui import *
from PyQt4.QtCore import *
from PyQt4.QtWebKit import *


app = QApplication([])

w = QWebView()

w.show()

url = QUrl("http://some/secure/site")
url.setUserName("myuser")
url.setPassword("correctpassword")

print url.toString()

w.load(url)

app.exec_()


I cannot get this code to connect to any .htaccess password-protected site that I know of. What am I doing wrong?


EDIT: I should add, the error in the apache logs basically indicates the wrong password, but I know I'm using the correct one. If I copy the URL that this script produces and paste it into any conventional browser, it logs in fine.

lykwydchykyn
May 12th, 2011, 05:26 AM
bump...