osome-iu / botometer-python

A Python API for Botometer by OSoMe
https://botometer.osome.iu.edu
MIT License
378 stars 60 forks source link

api_url not set in sub_instance #16

Closed shawnzam closed 6 years ago

shawnzam commented 6 years ago

It looks like when trying to use the pro api and the check_accounts_in method the api_url is set back to the basic endpoint. If you would like a pull, happy to give it a try.

https://github.com/IUNetSci/botometer-python/blob/master/botometer/__init__.py#L130

shawnzam commented 6 years ago

PS, Here is the relevant section of code:

botometer_api_url = 'https://botometer-pro.p.mashape.com'
bom = botometer.Botometer(botometer_api_url=botometer_api_url,
                          wait_on_ratelimit=True,
                          mashape_key=credentials.mashape_key,
                          **credentials.twitter_app_auth)

df = pd.read_csv(tweets_file, encoding = "ISO-8859-1")
accounts = numpy.unique(df['preferredUsername'].values)
account_size = accounts.size
print("Found {} uniq preferredUsernames".format(account_size))
for i, (screenname, result) in enumerate(bom.check_accounts_in(accounts)):
    print("{} of {}".format(i, account_size))
shawnzam commented 6 years ago

put a pull request in #17

clayadavis commented 6 years ago

Thanks for this important change to support our paid API!

clayadavis commented 6 years ago

PS, I'm thinking about how v2 of this library should look. If you have suggestions, please share them in this new issue.