-1

i am trying to fill out a webform using a python program by submitting specific values. the problem is it uses javascript. i will post an example of the value i want to fill.

fo.addVariable("email","[email protected]")
fo.addVariable("age","19")
fo.addVariable("gender","M")
fo.addVariable("line","hello")

that is an example of the value on the page. what i want to do is submit a value to that and change it. what i am currently attempting is this:

data = urllib.parse.urlencode({"line": "hello", "age": "50", "email":  "[email protected]", "gender": "M"}).encode()
resp = urlreq.urlopen("http://url.com/update", data) 

this usually works for most webforms. but for this one it will not.

1
  • First things first: Java is something completely different from Javascript. Commented Apr 21, 2013 at 6:31

1 Answer 1

0

In python 2.7, urllib has no attribute urllib.parse and a .encode() function at the end is unnecessary.

I think what you should be writing is

data = urllib.urlencode({"line": "hello", "age": "50", "email":  "[email protected]", "gender": "M"})
Sign up to request clarification or add additional context in comments.

2 Comments

im using python 3.3. plus none of the values are submitting.
and that is proper syntax for python 3.3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.