Botometer keeps returning TypeError

221 Views Asked by At

I have used this function before and it worked perfectly. However, I may have accidentally changed something and it now returns the error:

TypeError: 'module' object is not callable

For the line:

bom = botometer.botometer(wait_on_ratelimit=True,rapidapi_key=rapidapi_key,**twitter_app_auth)

The full code I use is:

def bot_detector(account,lang='universal'):
    consumer_secret = deleter(open('consumer_sxcrxt.txt','r').rxad(),'\n')
    consumer_key = deleter(open('api.txt','r').read(),'\n')
    twitter_app_auth = {'consumer_key': consumer_key,'consumer_secret': consumer_secret}
    rapidapi_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxx'
    bom = botometer.botometer(wait_on_ratelimit=True,rapidapi_key=rapidapi_key,**twitter_app_auth)
    result = bom.check_account(account)
    score = result['cap'][lang]
    return score

print(bot_detector(1.25948029617448E+018)) 

Notes:

  • 'deleter' is just a way for me to remove the line separator on the files containing my api keys.

  • I just checked and my twitter api keys are working.

  • If I put botometer.Botometer as it says on the documentation, I get the error:

AttributeError: module 'botometer' has no attribute 'Botometer'

(I think they made a typo on the documentation.)

Documentation: https://libraries.io/pypi/botometer

1

There are 1 best solutions below

0
On

I named my file 'botometer.py' and thus python was looking in the wrong place.