Trying to use mechanize in Python, I am stucked because the fields I am trying to submit don't have names.
On the mechanize tutorial, it is said:
br.select_form(name="order")
# Browser passes through unknown attributes (including methods)
# to the selected HTMLForm.
br["cheeses"] = ["mozzarella", "caerphilly"] # (the method here is __setitem__)
This is fine, but in my case the controls don't have name. Here is the code I run to ensure that:
resp = br.open("http://www.facebook.com/find-friends/browser/")
forms = ParseResponse(resp)
form = forms[2] # I know I have to select form 2
for control in forms[0].controls:
print control.name, control.type
And here is what I am getting (partially):
fb_dtsg hidden
friends_ids[] checkbox
None button
None hidden
None text
hometown_ids[] checkbox
None button
None hidden
None text
city_ids[] checkbox
None button
None hidden
None text
highschool_ids[] checkbox
None button
None hidden
None text
college_ids[] checkbox
So I am stucked here, as I can't apply the example from the tutorial (what I'd like to do is something like:
br['hometown'] = 'some town'
Does someone have a clue?
Thanks