0

i have an error

File "logins3", line 17, in <module>
    my_inputs = soup.findall('input')
TypeError: 'NoneType' object is not callable

my code

# extract the token

soup = BeautifulSoup(response.content)
my_inputs = soup.findall('input')

for input in my_inputs:
    print input.name + input['value'] #is here 

the information

<input type="hidden" name="return" value="ovL2FuaW1lZGlnaXRhbG5ldHdvcmsuZZXgucGhwL2Nvbm5leGlvbg==" />
    <input type="hidden" name="8d900dda34d7a3d37252b4a3c8" value="1" />

i need this token for create my script and I do not see how to fix it

ty

2 Answers 2

1

You need to use _ before a in soup.findall

my_inputs = soup.find_all('input')

OR

>>> my_inputs = soup.findAll('input')
>>> for in_put in my_inputs:
        print in_put.name , in_put['value']


input ovL2FuaW1lZGlnaXRhbG5ldHdvcmsuZZXgucGhwL2Nvbm5leGlvbg==
input 1
Sign up to request clarification or add additional context in comments.

Comments

1

This is a typo.

You meant to use find_all() instead of findall().


FYI, it didn't fail with AttributeError here because the dot notation in BeautifulSoup has a special meaning - soup.findall is basically shortcut to soup.find("findall"). In other words, it tried to find an element with findall name, failed and returned None. This is how you've got 'NoneType' object is not callable.

Comments

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.