Form Value Won't Post/Submit
The html code of the form, and my code are below. I can't get the
value to post/submit.. instead I get an error. Can anyone help?
HTML Code of Form:
Grant badge:
My Code:
opener = urllib.request.build_opener()
cj = http.cookiejar.MozillaCookieJar()
cj.load('C:/Users/Alison/Documents/moz_cookies.txt')
opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor
(cj))
params = urllib.parse.urlencode({'grant-userid' : 'Guest_xLolKittyx'})
form = urllib.request.OpenerDirector.open('http://www.imvu.com/catalog/
web_manage_badges.php?action=grant-revoke&creator_badge_index=1',
params)
data = form.read()
form.close()
print(data)
Error Message:
Traceback (most recent call last):
File "C:\Python31\htmlparser.py", line 34, in
form = urllib.request.OpenerDirector.open('http://www.imvu.com/
catalog/web_manage_badges.php?action=grant-
revoke&creator_badge_index=1', params)
File "C:\Python31\lib\urllib\request.py", line 332, in open
req = Request(fullurl, data)
File "C:\Python31\lib\urllib\request.py", line 174, in __init__
self._parse()
File "C:\Python31\lib\urllib\request.py", line 179, in _parse
raise ValueError("unknown url type: %s" % self.full_url)
ValueError: unknown url type: grant-userid=Guest_xLolKittyx
--
http://mail.python.org/mailman/listinfo/python-list
Re: Form Value Won't Post/Submit
Thank you so much for the quick response. I tried exactly what you
said but it still yields an error.. :/
Here is the Error Message:
Traceback (most recent call last):
File "C:\Python31\htmlparser.py", line 40, in
form = urllib.request.OpenerDirector.open('http://www.imvu.com/
catalog/web_manage_badges.php?action=grant-
revoke&creator_badge_index=1', params)
File "C:\Python31\lib\urllib\request.py", line 332, in open
req = Request(fullurl, data)
File "C:\Python31\lib\urllib\request.py", line 174, in __init__
self._parse()
File "C:\Python31\lib\urllib\request.py", line 179, in _parse
raise ValueError("unknown url type: %s" % self.full_url)
ValueError: unknown url type: action=grant-
revoke&creator_badge_index=1&token=92dcd92a8bc16f73f330d118ae1ed891&do-
grant=1&grant-userid=Guest_xLolKittyx
--
http://mail.python.org/mailman/listinfo/python-list
Re: Form Value Won't Post/Submit
Oops. Now I changed the URL, as you suggested, and I get the same error. -- http://mail.python.org/mailman/listinfo/python-list
Re: Form Value Won't Post/Submit
Anyway.. I'll close this thread, since Piet is helping me somewhere else. No more responses here are needed, thanks. -- http://mail.python.org/mailman/listinfo/python-list
