Salut les dev,
à partir d'un code Python, j'arrive à accéder à une page web, grace au module Mechanize, cependant je n'arrive pas à acceder a ses forms...
quand j'essaye de les printer 1 par 1 la liste les vide!!

quand j'affiche ça:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
print 'iciii les forms', br.forms()
ça m'affiche simplement: icii les forms []!

voici la totalité du code:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import mechanize
 
br = mechanize.Browser()
 
 
br.set_handle_robots(False)   # ignore robots
br.set_handle_refresh(False)  # can sometimes hang without this
 
br.open('https://darwin.md/apple/watch/')
 
print br
 
 
try:
    print 'je ss tryyyyyyyyyyyyyyyyyyyyyyyy'
    for f in br.forms():
        print(f)
        print 'loooooooooooooooool'
except mechanize._mechanize.FormNotFoundError as e:
    print 'mmmmmmmmmmmmmmmmmmmmmmeerde'
    print("Sorry no form found on this page", e)
 
 
print 'icii', br.forms()
 
 
 
 
 
br.form.set_value('ici-ton-login', name='name')
br.form.set_value('ici-ton-password', name='number')
 
 
br.submit()
print br.title()
br.follow_link(url='https://darwin.md/apple/watch/')
br.follow_link(url_regex=r'private.php$')
print br.title()
br.close()
Le plus embarrassant, c'est que j'ai lis un try catch, mais ça n'affiche rien!

quelqu'un pourrait m'aider svp?

mercii .