Sto cercando di estrarre il valore di un input nascosto tag. Anche se l'elemento esiste in HTML non riesco a trovare con bs4.
Questo è il messaggio di errore che mi esce:
AttributeError: 'NoneType' object has no attribute 'find'
Questo è il codice html della pagina web:
<form id="exampleid" class="exampleclass" action="/ex/ex-ex/ex/2" method="post">
<more html>
<div>
<input type="hidden" name="csrf" value="abcdefghijklmnopqrstuvwxyz">
</div></form>
E questo è il mio codice attuale:
csrf = soup.find("form", {"id": "exampleid"})
csrf = csrf.find('input', {'name': 'csrf'}).get("value")
print(csrf)
Gradirei qualsiasi tipo di aiuto, come si è realmente mi da fastidio. Vi ringrazio in anticipo!