0

What im trying to do is make a scraper and there is a login page, im filling two out of three values needed to get on the next page

the scraper needs a username,password and then the token,

im autofilling the username and password and ive narrowed the html response down to the one input tag in python.

The tags code is:

<input type="hidden" name="licence[_csrf_token]" value="SOME RANDOM CHECKSUM" id="licence__csrf_token" />

is there any way of getting this and by the way the checksum is dynamic as in it changes length.

John Hudson
  • 429
  • 1
  • 3
  • 11
  • What do you mean by "getting this"? Also, what tools have you used to extract the input tag from the HTML? – Robᵩ May 26 '15 at 14:53

1 Answers1

0

BeautifulSoup is one good way to parse arbitrary HTML:

from bs4 import BeautifulSoup

html_doc = '''<input type="hidden" 
                     name="licence[_csrf_token]" 
                     value="SOME RANDOM CHECKSUM"
                     id="licence__csrf_token" />'''

soup = BeautifulSoup(html_doc)
print soup.input['value']
Robᵩ
  • 163,533
  • 20
  • 239
  • 308