I bang my head against the wall with this. I tried every example, reading every last bit that I can find on the Internet, about basic http authorization with urllib2, but I can't figure out what causes my specific error.
Adding to the frustration is that the code works for one page, but not for another. Entrance to www.mysite.com/adm is absolutely smooth. It does not authenticate the problem. However, if I change the address to "http://mysite.com/adm/items.php?n=201105&c=200", I get this error:
<h4 align="center" class="teal">Add/Edit Items</h4> <p><strong>Client:</strong> </p><p><strong>Event:</strong> </p><p class="error">Not enough information to complete this task</p> <p class="error">This is a fatal error so I am exiting now.</p>
A google search resulted in zero information about this error.
The administrator is a page with a set of frames, I'm not sure that this is generally relevant.
Here is the current code:
import urllib2, urllib import sys import re import base64 from urlparse import urlparse theurl = 'http://xxxxxmedia.com/adm/items.php?n=201105&c=200' username = 'XXXX' password = 'XXXX' passman = urllib2.HTTPPasswordMgrWithDefaultRealm() passman.add_password(None, theurl,username,password) authhandler = urllib2.HTTPBasicAuthHandler(passman) opener = urllib2.build_opener(authhandler) urllib2.install_opener(opener) pagehandle = urllib2.urlopen(theurl) url = 'http://xxxxxxxmedia.com/adm/items.php?n=201105&c=200' values = {'AvAudioCD': 1, 'AvAudioCDDiscount': 00, 'AvAudioCDPrice': 50, 'ProductName': 'python test', 'frmSubmit': 'Submit' }
This is only one of the many versions I have tried. I followed each example from the Urllib2 Missing Manual, but still got the same error.
Can someone point out what I'm doing wrong?
python webforms urllib2 urllib
Zack Feb 03 2018-11-11T00: 00Z
source share